Solved

Script to delete a user

Posted on 2011-02-11
2
297 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
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

Join & Write a Comment

ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
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 …

747 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

10 Experts available now in Live!

Get 1:1 Help Now