I've read quite a bit online about this and thought I had found a solution, but it doesn't seem to be working like I would expect.
I am wanting to get a user based on the username I input, then remove all groups that it is a member of. Basically the same thing as going into ADUC, selecting the user, selecting the Member Of tab, highlighting everything (except domain users of course) and selecting remove.
Here's the command I'm trying to use:
Get-QADUser -Name $username | Remove-QADMemberOf -RemoveAll
Others have said online that it works for them, but so far it hasn't for me. It doesn't give an error, it accepts the command just fine, but when I look in ADUC, the groups are still there for the user.
Any suggestions as to what I may be doing wrong?
Executing from Windows 7 with domain admin rights, Exchange cmdlets and Quest snapin loaded.
Thanks!
I am using the following in my Disable user script (only added the part of removing the group membership)
why would i add the groups to notes you might ask, just in case i disabled the wrong user, it is always good to be able to undo ;)
Hope you find it usefull
Old thread, but for anyone still searching try this:
For example:
Get-QADUser -samaccountName SmithJ | Remove-QADMemberOf -RemoveAll