Hi,
Welcome to the Microsoft Q&A forum!
You can follow these steps using PowerShell. Here’s a step-by-step guide:
- Open PowerShell as an administrator.
- Connect to Exchange Online:
$UserCredential = Get-Credential Connect-ExchangeOnline -UserPrincipalName $UserCredential.UserName -Password $UserCredential.Password
- Import the CSV file:
$mailboxes = Import-Csv -Path "C:\path\to\your\file.csv"
- Initialize an array to store the results:
$results = @()
- Loop through each email and check the mailbox type:
foreach ($mailbox in $mailboxes) { $email = $mailbox.EmailAddress $mailboxDetails = Get-Mailbox -Identity $email -ErrorAction SilentlyContinue if ($mailboxDetails) { $isShared = $mailboxDetails.RecipientTypeDetails -eq "SharedMailbox" $results += [pscustomobject]@{ EmailAddress = $email MailboxType = if ($isShared) { "SharedMailbox" } else { "RegularMailbox" } } } else { $results += [pscustomobject]@{ EmailAddress = $email MailboxType = "NotFound" } } }
- Export the results to a CSV file:
$results | Export-Csv -Path "C:\path\to\results.csv" -NoTypeInformation
- Identify Shared Mailboxes and update licenses:
$sharedMailboxes = $results | Where-Object { $_.MailboxType -eq "SharedMailbox" } foreach ($sharedMailbox in $sharedMailboxes) { $email = $sharedMailbox.EmailAddress Set-MsolUserLicense -UserPrincipalName $email -RemoveLicenses "ENTERPRISEPACK" Set-MsolUserLicense -UserPrincipalName $email -AddLicenses "EXCHANGEONLINE_PLAN1" }