Created
July 17, 2019 23:18
-
-
Save tostka/3894a783ef7f18edf92208ef3364d1f6 to your computer and use it in GitHub Desktop.
One-Liner recreate RemoteMailbox against recreated EXOMailbox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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