\n Hi, and welcome to the PowerShell forum! \n\n\nDon’t apologize for being a “noob” or “newbie” or “n00b.” There’s just no need – nobody will think you’re stupid, and the forums are all about asking questions. Just ask!\nUse a descriptive subject. Don't say \"Need help\" or \"PowerShell Help\", actually summarize what the problem is. It helps the rest of us keep track of which problem is which.\nDon’t post massive scripts. We’re all volunteers and we don’t have time to read all that, nor will we copy, past…\n <\/blockquote>\n<\/aside>\n\n
<\/p>","upvoteCount":0,"datePublished":"2018-06-18T19:51:32.000Z","url":"https://community.spiceworks.com/t/remove-multiple-specific-users-from-multiple-groups/657526/2","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"
I am not sure I am understanding you correctly.<\/p>\n
You want every user removed from every group listed in the CSV?<\/p>\n
$csv = import-csv \"C:\\Victor\\File.csv\"\n\nforeach($user in $csv.users){\n foreach($group in $csv.groups){\n try{\n Remove-ADPrincipalGroupMembership $user -member $group -confirm:$false -ErrorAction Stop -verbose\n Write-Output \"User '$user' removed from '$group'\" |\n Out-File \"c:\\dinamio\\victorlogfile.txt\" -Append\n }\n catch{\n write-warning \"Error removing user '$User' fron '$group'\"\n }\n }\n}\n<\/code><\/pre>","upvoteCount":1,"datePublished":"2018-06-18T19:58:46.000Z","url":"https://community.spiceworks.com/t/remove-multiple-specific-users-from-multiple-groups/657526/3","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"Neally,<\/p>\n
Thank you!<\/p>\n
Basically yes, I want to Remove the specific user from column USER from the specific group on column GROUP.<\/p>","upvoteCount":0,"datePublished":"2018-06-18T20:09:49.000Z","url":"https://community.spiceworks.com/t/remove-multiple-specific-users-from-multiple-groups/657526/4","author":{"@type":"Person","name":"victorflorencio","url":"https://community.spiceworks.com/u/victorflorencio"}},{"@type":"Answer","text":"
Note, there are other users in those groups listed in CSV, but I want to remove only the users that are in the CSV.<\/p>","upvoteCount":0,"datePublished":"2018-06-18T20:13:29.000Z","url":"https://community.spiceworks.com/t/remove-multiple-specific-users-from-multiple-groups/657526/5","author":{"@type":"Person","name":"victorflorencio","url":"https://community.spiceworks.com/u/victorflorencio"}},{"@type":"Answer","text":"