remove multiple people from a single group in Active Directory
I am trying to remove multiple users from an Active Directory group.  I have a list of users by User ID (account ID).  And the group changes depending on what we need.  Is there a way to create a script that will request the name of the AD Group, find it, and then ask for a list of users to remove?  (cut N Paste?)  I have no idea how to go about starting to do this.  Any and all help would be apreciated. 
July 2nd, 2013 5:14pm

Get-Help Remove-ADGroupMember

Will show you what is needed, and this is what you will want to use. There are many ways to go about this, as the -Members property takes in an array of an ADPrincipal object, so you can do multiple users with one command

$group = Read-Host "Type name of group and hit enter"
$users = Get-Content C:\users.txt

Remove-ADGroupMember -Identity $group -Members $users

Something like that will work, I have not tested though, and there is no error checking, but basically, when ran it prompts the user for the name of the group, the users to be removed are in a text file, line by line, I would use the sAMAccountName in the text file.
Free Windows Admin Tool Kit Click here and download it now
July 2nd, 2013 5:42pm

Never mind.  It seems as if I will need to use vbscript instead as I get this error:

If you receive this error:

Unable to find a default server with Active Directory Web Service running

You do not have ADWS installed on at least one DC.

July 2nd, 2013 6:37pm

Never mind.  It seems as if I will need to use vbscript instead as I get this error:

If you receive this error:

Unable to find a default server with Active Directory Web Service running

You do not have ADWS installed on at least one DC.


You don't have any 2008 R2 or 2012 DCs? Even if you don't, installing/configuring ADWS is worth your time.
Free Windows Admin Tool Kit Click here and download it now
July 2nd, 2013 6:51pm

I do, but do not have the authority to install ADWS.  :(
July 2nd, 2013 7:41pm

You're in luck then, because you don't need to actually install anything. See this link:

http://technet.microsoft.com/en-us/library/dd391908%28v=ws.10%29.aspx

Snippet:

ADWS is installed automatically when you add the AD DS or AD LDS server roles to your Windows Server 2008 R2 server. ADWS is configured to run if you make this Windows Server 2008 R2 server a domain controller by running Dcpromo.exe or if you create an AD LDS instance on this Windows Server 2008 R2 server.

The most likely culprit is your firewall configuration. See the warning at the top of the page for more detail.

Free Windows Admin Tool Kit Click here and download it now
July 2nd, 2013 7:58pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics