Kristyan Osborne
2005-Jan-13 13:42 UTC
[Samba] Using WMI Classes to join worksation to domain
-----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-----
Gerald (Jerry) Carter
2005-Jan-14 20:17 UTC
[Samba] Using WMI Classes to join worksation to domain
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Kristyan Osborne wrote: | 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. The WMI calls should just plunk down to basic RPC's on the wire. Check your level 10 smbd log for ACCESS_DENIED and see which call failed. A network trace in ethereal miight prove helpful as well. cheers, jerry ====================================================================Alleviating the pain of Windows(tm) ------- http://www.samba.org GnuPG Key ----- http://www.plainjoe.org/gpg_public.asc "I never saved anything for the swim back." Ethan Hawk in Gattaca -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFB6CjKIR7qMdg1EfYRAry5AJwIu7KUAXg1zxq700h3G0DirU/AlwCg2jX5 nEM+qWr+Acit8ryk06KHskU=/TUp -----END PGP SIGNATURE-----