Skip to content

Instantly share code, notes, and snippets.

@tostka
Created July 17, 2019 23:18
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/3894a783ef7f18edf92208ef3364d1f6 to your computer and use it in GitHub Desktop.
Save tostka/3894a783ef7f18edf92208ef3364d1f6 to your computer and use it in GitHub Desktop.
One-Liner recreate RemoteMailbox against recreated EXOMailbox
$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