
You can restore the deleted user account within 30 days.įirst, connect to your Microsoft 365 tenant. Permanently remove Azure AD/Office 365 users via PowerShell Connect-MsolService Get-MsolUser -ReturnDeletedUsers Get-MsolUser -ReturnDeletedUsers Remove. After the above steps, now follow the below steps to deactivate previous Office 365 installation: a. Click on My account> My installs> Installs> Click on the Deactivate beside the device name. When you delete a user account through the Microsoft Azure Active Directory Module for Windows PowerShell, the account isn't permanently deleted. Sign into the Office 365 portal of your old user and click on the display name present at top-right of Office 365 Home page. Use the Microsoft Azure Active Directory Module for Windows PowerShell Write-Host (Get-AzureADUser | where ).UserPrincipalName To display the account name based on the user's name, use the following commands: $userName=""

The -ObjectID parameter in the Remove-AzureADUser cmdlet accepts either the account's sign-in name, also known as the User Principal Name or the account's object ID.
