Score:0

How to write a powershell script to remove all AD Group permissions for a user?

au flag

I'm in a rather large company and often have people change roles which requires changing of AD permissions, the process is in need of streamlining, currently there exists a script which copys permissions from a template user to the new user

However this still leaves the user with access to systems they had before which might not be required, currently these have to be removed manually. Is there a way to remove all permissions for a user via powershell? Or even just remove the ones that are 'different'?

us flag
You can use Get-ADUser to list the group memberships, then use the Remove-ADGroupMember cmdlet to remove the user from each group. You would want to post in the Stack Overflow forum for any help with writing a script. But this can also be done in a PS one-liner using the pipeline.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.