Skip to content

Instantly share code, notes, and snippets.

@tostka
Created July 17, 2019 23:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tostka/33eeed00473a602c145638dd17d4d276 to your computer and use it in GitHub Desktop.
Save tostka/33eeed00473a602c145638dd17d4d276 to your computer and use it in GitHub Desktop.
Recreate OPX RemoteUser mapping to recreated EXO mbx
$whatif = $true ;
$exombx = get-exomailbox $tAddress ;
$RemoteRoutingAddress = ($exombx.emailaddresses | ? { $_ -match '.*.mail\.onmicrosoft\.com' }).replace("smtp:", "");
$pltEnable = [ordered]@{
Identity = $exombx.alias ;
RemoteRoutingAddress = $RemoteRoutingAddress ;
whatif = $($whatif) ;
} ;
write-host -foregroundcolor green "$((get-date).ToString('HH:mm:ss')):Enable-RemoteMailbox w`n$(($pltEnable|out-string).trim())" ;
Enable-RemoteMailbox @pltEnable;
if (!$whatif) {
$pltSet = [ordered]@{
Identity = $exombx.alias ;
ExchangeGuid = $exombx.ExchangeGuid ;
whatif = $($whatif) ;
} ;
write-host -foregroundcolor green "$((get-date).ToString('HH:mm:ss')):Set-RemoteMailbox w `n$(($pltSet|out-string).trim())" ;
Set-RemoteMailbox @pltSet ;
get-remotemailbox -id $exombx.alias | select userprin*, samac*, recipientt* ;
} ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment