From babb5642cc89def5979d9b9a7a45d0cd413b9104 Mon Sep 17 00:00:00 2001 From: AdminDroid <49208841+admindroid-community@users.noreply.github.com> Date: Wed, 22 May 2024 14:52:23 +0530 Subject: [PATCH] Convert User Mailbox to Shared Mailbox in Bulk --- .../ConvertUserMailboxToSharedMailbox.ps1 | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 Convert User Mailboxes to Shared Mailboxes in Bulk/ConvertUserMailboxToSharedMailbox.ps1 diff --git a/Convert User Mailboxes to Shared Mailboxes in Bulk/ConvertUserMailboxToSharedMailbox.ps1 b/Convert User Mailboxes to Shared Mailboxes in Bulk/ConvertUserMailboxToSharedMailbox.ps1 new file mode 100644 index 0000000..331f787 --- /dev/null +++ b/Convert User Mailboxes to Shared Mailboxes in Bulk/ConvertUserMailboxToSharedMailbox.ps1 @@ -0,0 +1,54 @@ + +<# +============================================================================================= +Name: Convert user mailbox to shared mailboxes in bulk +Description: This script converts user mailboxes to shared mailboxes via import CSV +Version: 1.0 +Website: m365scripts.com +Blog: https://m365scripts.com/exchange-online/microsoft-365-convert-user-mailbox-to-shared-mailbox-using-powershell +============================================================================================ +#> + + +#Input File path declaration +$CSVPath= + +#Check for EXO module inatallation +$Module = Get-Module ExchangeOnlineManagement -ListAvailable + if($Module.count -eq 0) + { + Write-Host Exchange Online PowerShell module is not available -ForegroundColor yellow + $Confirm= Read-Host Are you sure you want to install module? [Y] Yes [N] No + if($Confirm -match "[yY]") + { + Write-host "Installing Exchange Online PowerShell module" + Install-Module ExchangeOnlineManagement -Repository PSGallery -AllowClobber -Force -Scope CurrentUser + Import-Module ExchangeOnlineManagement + } + else + { + Write-Host EXO module is required to connect Exchange Online.Please install module using Install-Module ExchangeOnlineManagement cmdlet. + Exit + } + } +Write-Host Connecting to Exchange Online... +Connect-ExchangeOnline -ShowBanner:$false +Import-CSV $CSVPath | foreach { + $UPN=$_.UPN + Write-Progress -Activity "Converting $UPN to shared mailbox… " + Set-Mailbox –Identity $UPN -Type Shared + If($?) + { + Write-Host $UPN Successfully converted to shared mailbox -ForegroundColor cyan + } + Else + { + Write-Host $UPN - Error occurred –ForegroundColor Red + } +} + +#Disconnect Exchange Online session +Disconnect-ExchangeOnline -Confirm:$false | Out-Null +Write-Host `n~~ Script prepared by AdminDroid Community ~~`n -ForegroundColor Green +Write-Host "~~ Check out " -NoNewline -ForegroundColor Green; Write-Host "admindroid.com" -ForegroundColor Yellow -NoNewline; Write-Host " to get access to 1800+ Microsoft 365 reports. ~~" -ForegroundColor Green `n`n + \ No newline at end of file