Microsoft Surface Hub 2 SmCamera User Manual

Page 529

Advertising
background image

if

($Error)

{
$status[

"Skype for Business Account Setup"

] =

"Failed to setup the Skype

for Business meeting room - you can run EnableSfb.ps1 to try again."

$Error.Clear();
}

else

{
$status[

"Skype for Business Account Setup"

] =

"Successfully enabled

account as a Skype for Business meeting room"

}

## Now we need to assign a Skype for Business license to the account ##

# Assign a license to thes

$countryCode = (

Get-CsTenant

).CountryAbbreviation

$loc =

Read-Host

"Please enter the usage location for this device account

(where the account is being used). This is a 2-character code that is used
to assign licenses (e.g. $countryCode)"

try

{

$Error.Clear()

Set-MsolUser

-UserPrincipalName

$credNewAccount.UserName

-UsageLocation

$loc
}
catch{}

if

($Error)

{
$status[

"Office 365 License"

] =

"Failed to assign an Office 365 license

to the account"

$Error.Clear()
}

else

{
PrintAction

"We found the following licenses available for your tenant:"

$skus = (

Get-MsolAccountSku

|

Where-Object

{

!$_.AccountSkuID.Contains(

"INTUNE"

); })

$i = 1
$skus | % {

Write-Host

-NoNewline

$i

Write-Host

-NoNewLine

": AccountSKUID: "

Write-Host

-NoNewLine

$_.AccountSkuid

Write-Host

-NoNewLine

" Active Units: "

Write-Host

-NoNewLine

$_.ActiveUnits

Write-Host

-NoNewLine

" Consumed Units: "

Write-Host

$_.ConsumedUnits

$i++
}
$iLicenseIndex = 0;

do

{
$iLicenseIndex =

Read-Host

'Choose the number for the SKU you want

to pick'

}

while

($iLicenseIndex -lt 1

-or

$iLicenseIndex -gt $skus.Length)

$strLicenses = $skus[$iLicenseIndex - 1].AccountSkuId

if

(![System.String]::IsNullOrEmpty($strLicenses))

Advertising