A client recently assigned me to clear all group memberships for all users in an OU.
Googling didn’t immediately come up with any great solutions to this seemingly simple problem.
So I decided to write a simple routine myself. Maybe you can use it too?
$Users = Get-ADUser -Filter * -SearchBase "OU=Users,OU=Denmark,OU=E365M,DC=easy365manager,DC=local" -Properties *
ForEach($User In $Users){
$MemberOf = $User.MemberOf
ForEach($Group In $MemberOf){
Write-Host Removing $User from $Group
Remove-ADGroupMember $Group $User -Confirm:$false
}
}
The output of the script lets you follow the progress. And if you need to reverse the action for some reason, it’s always nice to know what changes you made.
Make sure to test if the script meets your specific needs before taking it into production.
Manage Office 365 From Active Directory
If you’re running a hybrid Office 365 environment, chances are you’re not happy with the default administrative tools from Microsoft.
Consider something like provisioning a shared mailbox. This requires several different tools and PowerShell scripting.
And it easily takes five to ten minutes out of a senior supporter’s sparse time.
With Easy365Manager you can provision a shared Office 365 mailbox directly from AD Users & Computers. In just over a minute:
Easy365Manager is a snap-in to AD Users & Computers that allows you to perform all daily Office 365 management without resorting to multiple tools and PowerShell.
With Easy365Manager, your first-level support will be much more productive (and happy).
You can even offload many complex tasks from senior supporters, like calendar delegation, which usually requires complex PowerShell scripting.
With Easy365Manager, calendar delegation is very intuitive and requires practically no instructions:
You can install Easy365Manager to any server or PC running AD Users & Computers.
Easy365Manager requires no infrastructure changes and can be installed in less than one minute.
To see a complete list of features for Easy365Manager, have a look at this.
You can download the fully functional 30-day trial here.