Issue: Take a list of usernames from a CSV file and recursively remove them from all of the user groups that they are a member of. I would like to limit what groups they are removed from based upon a prefix for the group name.
Example: If user_bob (one of the many usernames within the CSV) was a member of the the following groups (determined recursively): abc-users, abc-printers, abc-users-limited, xzy-users, xyz-secure, then I would like to have the PowerShell script remove him from all groups that are prefixed with "abc-" and then move on to the next username in the CSV and perform the same process.
Notes: I have been searching all over online for examples for something like this and cannot seem to locate any leads. Code snippets or samples that I can begin the process of testing with or putting together into a solution would be most appreciated. I have been looking through the TechNet documentation for the commandlets and have not made much progress. Thanks in advance!