Solved

Script to delete a user

Posted on 2011-02-11
2
300 Views
Last Modified: 2012-05-11
I have a very small script that pulls the group membership for a user:
dsget user UserDN -memberof

What I wanted to do was pull the results of that script, which are the group DNs, into some type of script that would remove the user from those groups.  This command will remove the user from the group.  But how would I get just one script to do all of it?
dsmod group GroupDN -rmmbr UserDN

Any suggestions would help.
0
Comment
Question by:sedberg1
[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
2 Comments
 
LVL 8

Expert Comment

by:Toxacon
ID: 34873535
I recommend using PowerShell (and PS scripts), which is good for cases like this.
0
 
LVL 27

Accepted Solution

by:
KenMcF earned 500 total points
ID: 34873815
Since Toxacon mentioned Powershell you can do this using the Quest AD cmdlets

$user = "USERNAME"
get-qadmemberof $User | %{
Remove-QADGroupMember $_ $User
}

0

Featured Post

Free Webinar: AWS Backup & DR

Join our upcoming webinar with experts from AWS, CloudBerry Lab, and the Town of Edgartown IT to discuss best practices for simplifying online backup management and cutting costs.

Question has a verified solution.

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

Last week, our Skyport webinar on “How to secure your Active Directory” (https://www.experts-exchange.com/videos/5810/Webinar-Is-Your-Active-Directory-as-Secure-as-You-Think.html?cid=Gene_Skyport) provided 218 attendees with a step-by-step guide for…
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

733 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