Hi All,
I am trying to come up with a process to remove a set of disabled users from all their group memberships in AD using a CSV
I have exported a list of users to a CSV with their SamAccountName and GroupName
The fields are:
SamAccountName,Name
Import-Csv C:\Temp\SAMPLE.csv |
ForEach-Object {
get-aduser -filter "SamaccountName -eq '$($_.SamaccountName)'" | Remove-ADGroupMember
}
I would like if possible to come up with a way to loop through the CSV and remove the groups but also to reverse this should I need to roll back the change in bulk.
Any thought's how I might achieve this?
Thanks