Last active
July 26, 2016 15:40
-
-
Save thomasrayner/90c42b73b8b063257423d1845cb55369 to your computer and use it in GitHub Desktop.
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
(get-command gimme-exchange).definition | |
$arrExchangeServersURI = @("http://redacted/Powershell","http://redacted2/Powershell") | |
$success = $false | |
ForEach ($connectionURI in $arrExchangeServersURI) | |
{ | |
Try | |
{ | |
If($success -ne $true) | |
{ | |
$getMBXconn = new-pssession -configurationname Microsoft.Exchange -connectionuri $connectionURI -Authentication Kerberos <#-Credential $UserCredential#> | |
$null = Import-PSSession -AllowClobber $getMBXConn | |
$success = $true | |
} | |
} | |
catch [Exception] | |
{ | |
$strError = $_.Exception.Message | |
$strError = "Error: ${strError}" | |
$success = $false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment