Microsoft Surface Hub 2 SmCamera User Manual
Page 530

{
try
{
$Error.Clear()
Set-MsolUserLicense
-UserPrincipalName
$credNewAccount.UserName
-AddLicenses
$strLicenses
}
catch
{
}
if
($Error)
{
$Error.Clear()
$status[
"Office 365 License"
] =
"Failed to add a license to the
account. Make sure you have remaining licenses."
}
else
{
$status[
"Office 365 License"
] =
"Successfully added license to
the account"
}
}
else
{
$status[
"Office 365 License"
] =
"You opted not to install a license
on this account"
}
}
Write-Host
## Cleanup and print results ##
Cleanup
$strDisplay = $mailbox.DisplayName
$strUsr = $credNewAccount.UserName
PrintAction
"Summary for creation of $strUsr ($strDisplay)"
if
($status.Count -gt 0)
{
ForEach
($k
in
$status.Keys)
{
$v = $status[$k]
$color =
"yellow"
if
($v[0] -eq
"S"
) { $color =
"green"
}
elseif
($v[0] -eq
"F"
)
{
$color =
"red"
$v +=
" Go to https://aka.ms/shubtshoot for help"
}
Write-Host
-NoNewline
$k
-ForegroundColor
$color
Write-Host
-NoNewline
": "
Write-Host
$v
}