Changing usertypes using batch file

Is there a way to change the active directory usertype using the command prompt.  I'd like to use this in a batch file.
Thanks,
LVL 1
VaughanCAsked:
Who is Participating?
 
AntyraelConnect With a Mentor Commented:
Correction, that was not the sales group, obviously, it was the Power users group ;)
0
 
AntyraelCommented:
What exactly do you plan to change? Can you be more specific?
0
 
VaughanCAuthor Commented:
I have user access controlled by group policies.  I've just realised what I'm trying to do is to remove membership from one Global Security Group and add membership of another.  I'd like to do this with a batch file if possible.
Thanks,
0
 
AntyraelCommented:
If you can run the batch files on a domain controller, a server with adminpak installed (Windows Server 2003) or AD tools from Server 2008, you can use the dsquery and dsmod commands.

For example, the following command adds user with samaccountname bob to the sales group:
dsquery -samid bob | dsmod group "cn=Power Users,cn=Users,dc=intra,dc=net" -addmbr

To remove the same user from a group, use:
dsquery -samid bob | dsmod group "cn=Power Users,cn=Users,dc=intra,dc=net" -rmmbr

You can use different search parameters instead of the samaccountname, try dsquery /? for more information.
0
 
VaughanCAuthor Commented:
Thanks for that.
0
All Courses

From novice to tech pro — start learning today.