Removing Multiple User Group Membership
hello seeking some assistance.
quite bit of employees have left company such needed disable alot of user accounts. used dsmod disable of users fine..
example: dsquery user -name "karen*walker" | dsmod user -disabled yes
what know if there way in can remove group membership (in a similar manner example above) except domain users... i don't want exchange users to receive bounced messages disabled users still in various distribution groups etc?
eg: karen walker --memberof contain [headoffice, domainuser, besdistribution, helpdesk etc] , want left domainusers.
powershell
$userdn = "distinguished name of user" get-adgroup -ldapfilter "(member=$userdn)" | foreach-object { if ($_.name -ne "domain users") {remove-adgroupmember -identity $_.name -member $userdn} }
Windows Server > Windows Server General Forum
Comments
Post a Comment