Microsoft Surface Hub 2 SmCamera User Manual
Page 522

if
($sessExchange)
{
Remove-PSSession
$sessExchange
}
if
($sessCS)
{
Remove-PSSession
$sessCS
}
}
function
PrintError($strMsg)
{
Write-Host
$strMsg
-foregroundcolor
Red
}
function
PrintSuccess($strMsg)
{
Write-Host
$strMsg
-foregroundcolor
Green
}
function
PrintAction($strMsg)
{
Write-Host
$strMsg
-ForegroundColor
Cyan
}
# Cleans up and prints an error message
function
CleanupAndFail($strMsg)
{
if
($strMsg)
{
PrintError($strMsg);
}
Cleanup
exit
1
}
# Exits if there is an error set and prints the given message
function
ExitIfError($strMsg)
{
if
($Error)
{
CleanupAndFail($strMsg);
}
}
## Check dependencies ##
try
{
Import-Module
SkypeOnlineConnector
Import-Module
MSOnline
}
catch
{
PrintError
"Some dependencies are missing"