VaughanC
asked on
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,
Thanks,
What exactly do you plan to change? Can you be more specific?
ASKER
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,
Thanks,
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.
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
To remove the same user from a group, use:
dsquery -samid bob | dsmod group "cn=Power Users,cn=Users,dc=intra,dc
You can use different search parameters instead of the samaccountname, try dsquery /? for more information.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for that.