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.
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.
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.
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.