Function TestMsolConnection { | |
<# | |
.Synopsis | |
A function that tests the Microsoft Online connection. | |
.Description | |
A function that tests the Microsoft Online connection. | |
.Example | |
TestMsolConnection | |
Tests to see if the Microsoft Online connection is available. | |
.Notes | |
Author: David Green | |
#> | |
[CmdletBinding()] | |
[OutputType( | |
[bool] | |
)] | |
Param() | |
try { | |
Get-MsolCompanyInformation -ErrorAction Stop | Out-Null | |
Write-Verbose 'Microsoft Online connection test success.' | |
Write-Output $true | |
} | |
catch [Microsoft.Online.Administration.Automation.MicrosoftOnlineException] { | |
Write-Verbose 'Microsoft Online connection test failure.' | |
Write-Output $false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment