Shutdown Account Office365


This script will;

Remove the User From All Groups
Set Sign In to Disabled
Convert the Mailbox to Shared
Remove the Associated Licenses

Please read through script to ensure you know what to do. Removing the license requires that you find out information about your Office365 subscription, the information is in the script for the commands you need to run.

Any questions or suggestions on improvement are welcome!

Source Code

This script has not been checked by Spiceworks. Please understand the risks before using it.


This script will disable an Office 365 Account

This script was built to enable an Administrator to quickly disable an Office 365 account as well as removing the Exchange 
license and converting the mailbox to shared.



Ensure when you run the script you are doing it from the correct directory.


#Removing Group Membership

Get-DistributionGroup | Remove-DistributionGroupMember -Member $EmailAddress

#Set Account To Disabled
write-host 'Setting Sign In Status to Blocked'
Set-MsolUser -UserPrincipalName $EmailAddress -blockcredent

About: george

Leave a Reply

Your email address will not be published. Required fields are marked *