Solved

Changing usertypes using batch file

Posted on 2010-11-09
5
348 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Roaming Profiles 8 60
active directory 3 17
PowerShell one liner to pull server names 3 33
How to transfer FSMO roles 2 40
Introduction You may have a need to setup a group of users to allow local administrative access on workstations.  In a domain environment this can easily be achieved with Restricted Groups and Group Policies. This article will demonstrate how to…
On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now