powershell convert mailbox to sharedmailbox if it is a usermailbox and verify
- User
powershell convert mailbox to sharedmailbox if it is a usermailbox and verify
- Assistant
To convert a user mailbox to a shared mailbox using PowerShell and verify the conversion, follow these steps:
Step 1: Connect to Exchange Online
First, connect to Exchange Online PowerShell:
Connect-ExchangeOnline -UserPrincipalName [EMAIL_ADDRESS]Replace [EMAIL_ADDRESS]` with your admin account.
Step 2: Convert a Single Mailbox
Use
Set-Mailboxwith the-Typeparameter:Set-Mailbox -Identity "[EMAIL_ADDRESS]" -Type SharedReplace [EMAIL_ADDRESS]` with the target mailbox’s email or display name. No output is returned if successful[2][5][8].
Step 3: Verify Conversion
Check the
RecipientTypeDetailsproperty:Get-Mailbox -Identity "[EMAIL_ADDRESS]" | Format-Table Name, RecipientTypeDetailsSuccessful conversion will show:
Name RecipientTypeDetails ---- -------------------- User Name SharedMailbox[2][5][8]
Bulk Conversion via CSV
For multiple mailboxes, use a CSV file with a
PrimarySmtpAddresscolumn:-
Sample CSV (
bulk.csv):PrimarySmtpAddress [EMAIL_ADDRESS] [EMAIL_ADDRESS] -
Run the script:
$csvPath = "C:\path\to\bulk.csv" Import-Csv $csvPath | ForEach-Object { $email = $_.PrimarySmtpAddress $mailbox = Get-Mailbox -Identity $email -ErrorAction SilentlyContinue if (-not $mailbox) { Write-Host "Mailbox '$email' not found." -ForegroundColor Red } elseif ($mailbox.RecipientTypeDetails -eq "SharedMailbox") { Write-Host "Mailbox '$email' is already shared." -ForegroundColor Cyan } else { Set-Mailbox -Identity $email -Type Shared -ErrorAction SilentlyContinue $updated = Get-Mailbox -Identity $email if ($updated.RecipientTypeDetails -eq "SharedMailbox") { Write-Host "Converted '$email' successfully." -ForegroundColor Green } else { Write-Host "Failed to convert '$email'." -ForegroundColor Red } } }This script handles errors, skips existing shared mailboxes, and confirms success[2][5].
Post-Conversion Steps
- Remove the license from the original user account in the Microsoft 365 Admin Center to avoid unnecessary charges[5][8].
- Block sign-in for the shared mailbox to enhance security[8].
Troubleshooting
- If the
Set-Mailboxcmdlet fails, ensure you’re using the latest Exchange Online PowerShell module (V3+)[4]. - Verify connectivity with
Get-Mailboxto rule out authentication issues.
By following these steps, you can efficiently convert mailboxes and validate their status.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.