blog.icewolf.ch

Let's talk about IT!
posts - 2247, comments - 295, trackbacks - 0

My Links

Archives

Post Categories

icewolf

Rename UPN of specific Mailbox Types

Hi All,

Recently i had a customer where the Room Mailboxes had still the Active Directory UPN Suffix.
But that needed to Change in Order to align with Exchange Hybrid / Exchange Online.



So i did write a small PowerShell Script to fix that

The Script can also be found at my GitHub Repo

###############################################################################
# Rename UPN from specific Mailbox Type
# 11.04.2022 V0.1 - Andres Bohren - Initial Version
###############################################################################
$Rooms = Get-Mailbox -RecipientTypeDetails RoomMailbox -Resultsize Unlimited
Foreach ($Room in $Rooms)
{
    $Email = $Room.PrimarySMTPAddress
    $Alias = $Room.Alias
    $UPN = $Room.UserPrincipalName
    Write-Host "Working on: $Email / $UPN" -ForegroundColor Green
    If ($UPN -match "corp.icewolf.ch")
    {
        Write-Host "Match found"
        $NewUPN = $UPN.Replace("corp.icewolf.ch","icewolf.ch")
        Write-Host "NewUPN: $NewUPN"
        Set-Mailbox -Identity $UPN -UserPrincipalName $NewUPN
    }
}




Regards
Andres Bohren


Print | posted on Monday, April 11, 2022 7:42 AM | Filed Under [ Exchange ]

Powered by:
Powered By Subtext Powered By ASP.NET