Avatar of pendal1
pendal1
Flag for United States of America asked on

Remove multiple users from an AD group with powershell

Hello all and thanks for your time and expertise.  I'm still green at powershell and I've been tasked with removing multiple users from an AD group.  Please note I've already created a .txt file with all of the samaccountnames of the relevant users.  
The affected users are all in the same OU and that's where I exported the list of login names from.  
Would really appreciate if someone could provide me the syntax for this kind of operation.  Thanks.
Active DirectoryPowershell

Avatar of undefined
Last Comment
SubSun

8/22/2022 - Mon
pgm554

Why not just use Solarwinds?
It's free and it will do what you need.

http://www.solarwinds.com/free-tools/active-directory-admin-tools-bundle/
ASKER CERTIFIED SOLUTION
SubSun

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
sAMAccountName

Embrace Powershell.  Abandon third party apps.

This is rudimentary but works:
$List = Get-Content "C:\Users\jdoe\Desktop\input.txt" 
Foreach ($Item in $List){Remove-ADGroupMember -Identity GroupName -Member $Item}

Open in new window

SubSun

Options provided should resolve user queries.
Your help has saved me hundreds of hours of internet surfing.
fblack61