I have a script, derived from this post, which adds workstations to our domain. This script is run from the PC that is being added to the domain by a local admin on the workstation.

What I am now hoping to do, is have the same script add the same workstation to one or more AD groups.

I have played around with a couple of methods I've found on this site: Here and here. These methods are either not available on member workstations that do not have the AD tools installed, or attempt to run as the currenly logged in user, which does not have rights.

I've investigated remotely executing dsmod on server with the tools installed from the target workstation with wmic:
Sample:

 Code:
wmic /node:[node] /user:[userid] /password:[password] process call create "cmd.exe /c dsmod group cn=groupname,ou=groups,ou=site,dc=domain,dc=com -addmbr cn=workstation,ou=workstations,ou=site,dc=domain,dc=com"


I think the above method could be workable, but I can't seem to figure out the correct usage/placement of the quotes.

Has anyone ever done anything like this, or can you provide some ideas or suggestions?

Requirements:
Must be run from the workstation itself.
Must be run by a local administrator.
Probably needs to be able to specify a domain user/pw to run the add command as (no PW prompting).


Edited by Krozar (2012-03-09 10:12 PM)