Microsoft Surface Hub 2 SmCamera User Manual

Page 524

Advertising
background image

CleanupAndFail

"Failed to connect to Skype for Business Online

Datacenter. Please check your credentials and try again. Error message: $_"

}

try

{

Connect-MsolService

-Credential

$credAdmin

}
catch
{
CleanupAndFail

"Failed to connect to Azure Active Directory. Please

check your credentials and try again. Error message: $_"

}

Import-PSSession

$sessExchange

-AllowClobber -WarningAction

SilentlyContinue

Import-PSSession

$sessCS

-AllowClobber -WarningAction

SilentlyContinue

## Create the Exchange mailbox ##

> [!Note]
> These exchange commandlets

do

not always

throw

their errors as exceptions

# Because Get-Mailbox will throw an error if the mailbox is not found

$Error.Clear()
PrintAction

"Creating a new account..."

try

{
$mailbox =

$null

$mailbox = (

New-Mailbox

-MicrosoftOnlineServicesID

$credNewAccount.UserName

-room -Name

$strDisplayName

-RoomMailboxPassword

$credNewAccount.Password

-EnableRoomMailboxAccount

$true

)

} catch { }
ExitIfError

"Failed to create a new mailbox on exchange."

;

$status[

"Mailbox Setup"

] =

"Successfully created a mailbox for the new

account"

$strEmail = $mailbox.WindowsEmailAddress
PrintSuccess

"The following mailbox has been created for this room:

$strEmail"

## Create or retrieve a policy that will be applied to surface hub devices
##

# The policy disables requiring a device password so that the SurfaceHub
does not need to be lockable to use Active Sync

$strPolicy =

Read-Host

'Please enter the name for a new Surface Hub

ActiveSync policy that will be created and applied to this account.
We will configure that policy to be compatible with Surface Hub devices.
If this script has been used before, please enter the name of the existing
policy.'

$easpolicy =

$null

try

{

$easpolicy =

Get-MobileDeviceMailboxPolicy

$strPolicy

}

Advertising