Skip to content

Instantly share code, notes, and snippets.

@ddhahn
Last active December 12, 2015 01:38
Show Gist options
  • Save ddhahn/4692234 to your computer and use it in GitHub Desktop.
Save ddhahn/4692234 to your computer and use it in GitHub Desktop.
Remove AD user from AD groups stored in a file
#read a list of CN's of groups from a file and remove the specified user from
#that group
#uses the quest AD cmdlets.. Probable need to change to built in AD stuff.
$groups = Get-Content "c:\temp\groups_to_remove.txt"
foreach ($group in $groups)
{
Write-Host $group
Remove-QADGroupMember -Identity $group -Member "contoso\mary" -WhatIf
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment