Solved

Changing usertypes using batch file

Posted on 2010-11-09
5
350 Views
Last Modified: 2012-05-10
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,
0
Comment
Question by:VaughanC
  • 3
  • 2
5 Comments
 
LVL 4

Expert Comment

by:Antyrael
ID: 34091758
What exactly do you plan to change? Can you be more specific?
0
 
LVL 1

Author Comment

by:VaughanC
ID: 34091911
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
 
LVL 4

Expert Comment

by:Antyrael
ID: 34092375
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
 
LVL 4

Accepted Solution

by:
Antyrael earned 250 total points
ID: 34092384
Correction, that was not the sales group, obviously, it was the Power users group ;)
0
 
LVL 1

Author Closing Comment

by:VaughanC
ID: 34103401
Thanks for that.
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This article runs through the process of deploying a single EXE application selectively to a group of user.
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

822 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question