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
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