Convert User Mailbox to Shared Mailbox

In a Co-operate environment when users leave and you wanted to store the mailbox as a shared mailbox for reference or maybe for security and compliance reasons this script below will come handy to you in such scenarios.

Script could help you on major projects like cleaning up the exchange environment or getting into a structure.

# Import CSV File
   $MailboxTypeList = IMPORT-CSV "mailbox details .csv"

Foreach ($RecipientType in $MailboxTypeList)
{
      $UserOrShared = $RecipientType.RecipientType
      $EmailAddress = $RecipientType.WindowsEmailAddress
      $Display = $RecipientType.DisplayName


      Write-Host "RecipientType: "$UserOrShared
      Write-Host "Email Address: "$EmailAddress


   If ($UserOrShared -eq "User")
   {
      Write-Host "Changing Mailbox: "$Display
      #$Members = Set-Mailbox -Identity $EmailAddress -Type Shared
    }
}

The details that should be in the CSV file are below.

Identity, Alias, DisplayName, RecipientType, UserPrincipalName, WindowsEmailAddress

Published by iamfazul

Author of the site

Leave a comment