Office 365: How to Remove an Online User Permanently
The following steps help System Administrators to remove MS online users from Office 365 Portal by using Windows PowerShell.
Steps
1. Microsoft Online Services Sign-In Assistant
1. Download and Install Microsoft Online Services Sign-In Assistant for IT Professionals RTW.
Microsoft Azure PowerShell:
Run PowerShell as Administrator
Run the followind cmd:
Set-ExecutionPolicy RemoteSigned
$UserCredential = Get-Credential (you need to sign in as the Office 365 Portal Admin)
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential admin@mycompany.onmicrosoft.com -Authentication Basic -AllowRedirection (you need to type the Office 365 portal admin password)
Import-PSSession $Session
Connect-MsolService -Credential $cred (you need to sign in again with your Office 365 portal admin again)
remove-msoluser –userprincipalname user@mycompany.onmicrosoft.com (to move the user from Active Users to Deleted Users)
remove-msoluser –userprincipalname user@mycompany.onmicrosoft.com -RemoveFromRecycleBin (to remove the online user permanently)
4. Double check
Check whether the user was removed or not: Get-MsolUser
5. Close session
To close the session after you finish:
Remove-PSSession $Session
Important
Please note that you cannot restore the deleted user after removing it permanently from the portal.