How did I properly offboard users in microsoft 365 with powershell
- User
How did I properly offboard users in microsoft 365 with powershell
Assistant
To properly offboard users in Microsoft 365 with PowerShell, you can follow these steps:
- Connect to the Microsoft 365 Admin Center with PowerShell:
Connect-Microsoft365Account- Disable the user account:
Get-M365User -UserPrincipalName <user_email> | Disable-M365User- Remove the user from any groups or teams they belong to:
Get-M365Group | Where-Object { $_.Owner -eq <user_email> } | Remove-M365GroupOwner -Owner <new_owner>- Remove the user's licenses:
Get-M365User -UserPrincipalName <user_email> | Remove-M365UserLicense- Delete the user's mailbox and OneDrive:
Get-M365User -UserPrincipalName <user_email> | Remove-M365UserMailbox- Finally, you can use the
Remove-M365Usercmdlet to completely delete the user's account from Microsoft 365:
Get-M365User -UserPrincipalName <user_email> | Remove-M365UserIt's important to note that these steps will permanently delete the user's account and data from Microsoft 365, so it's important to ensure that you have backed up any important data before proceeding.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.