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!
Param( [string]$EmailAddress ) <# .SYNOPSIS This script will disable an Office 365 Account .DESCRIPTION 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. .PARAMETER firstname.lastname@example.org .EXAMPLE shutdown-Account.ps1 email@example.com .NOTES 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