Private/HelperFunctions/Test-MSOnline.ps1
function Test-MSOnline () { if (Get-Command Connect-MsolService -eq '$true'-ErrorAction SilentlyContinue) { Write-Debug -Message "MSOnline module loaded" } else { Write-Debug -Message "MSOnline module is not loaded" try { Install-Module MSOnline -Scope CurrentUser -Force } catch { Return 1 } } } |