-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I have been working on a Kix script to automatically change the workstation 
name and join the workstation to the domain. I have written most of the script 
(which works quite nicely) except the joining to the domain part. I have been 
using WMI classes to change the worksation name, and was hoping to do the same 
with the domain join. The workstations are WinXP.

The code i'm using is 

$objWMIService = GetObject("winmgmts:" + "{impersonationLevel=impersonate, 
authenticationLevel=Pkt}!\\.\root\cimv2")
$colComputers = $objWMIService.ExecQuery ("Select * from Win32_ComputerSystem")
For Each $objComputer in $colComputers
    $ERRH = 
$ObjComputer.joindomainorworkgroup(domainname,"password","domainname\root","",1)
Next

if $ERRH <> 0
        color r+/n
        AT (2,6) "[ERROR: DOMAIN JOIN FAILED - " + $ERRH + "]"
        exit
else
        color g+/n
        AT (2,6) "[INFO: Workstation joined to domain LONGHILL]"
        sleep 2
endif

This always fails with error code 1326 (username or password invalid). However 
looking at the logs on the Samba server, it tells me that the authentication 
for user root was successful.

Is this a fundermental mistake of mine, where Samba doesn't support these WMI 
calls, or is it something I'm overlooking.

Any help would be good

- -------------
Kristyan Osborne - IT Technician
Longhill High School
01273 391672 / 304086

- ------
Computers are like airconditioners: They stop working properly if you open 
windows.
Win95:       A 32-bit patch for a 16-bit GUI shell running on top of an
             8-bit operating system written for a 4-bit processor by a
             2-bit company who cannot stand 1 bit of competition.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)

iD8DBQFB5nq9qrr+KdRYU5gRAux6AJ9ukLm1ErvYR2h5NtEi9tIBCjMrKQCcC13l
JirfE+hKvk2f6MdgvpgyfKc=
=ulw8
-----END PGP SIGNATURE-----

--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/listinfo/samba

Reply via email to