Skip to content

Instantly share code, notes, and snippets.

@thomasrayner
Last active July 26, 2016 15:40
Show Gist options
  • Save thomasrayner/90c42b73b8b063257423d1845cb55369 to your computer and use it in GitHub Desktop.
Save thomasrayner/90c42b73b8b063257423d1845cb55369 to your computer and use it in GitHub Desktop.
(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