Solved

Changing usertypes using batch file

Posted on 2010-11-09
5
352 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
Active Directory security has been a hot topic of late, and for good reason. With 90% of the world’s organization using this system to manage access to all parts of their IT infrastructure, knowing how to protect against threats and keep vulnerabil…
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…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

726 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