Skip to content

Instantly share code, notes, and snippets.

@mattmcnabb
Created January 8, 2017 22:04
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 mattmcnabb/7328efdb65f49bab925aac0d45af0427 to your computer and use it in GitHub Desktop.
Save mattmcnabb/7328efdb65f49bab925aac0d45af0427 to your computer and use it in GitHub Desktop.
Testing Async calls to Office 365
$PowerShell = [powershell]::Create()
$null = $PowerShell.AddScript({
param($Credential)
$ExchParams = @{
ConfigurationName = 'microsoft.exchange'
ConnectionUri = "https://outlook.office365.com/powershell-liveid/"
Credential = $Credential
Authentication = 'Basic'
AllowRedirection = $true
}
$ExchSession = New-PSSession @ExchParams
Import-PSSession -Session $ExchSession
Get-Mailbox Matt
}).AddArgument($Cred)
$Handle = $PowerShell.BeginInvoke()
$PowerShell.EndInvoke($Handle)
$PowerShell.Dispose()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment