Microsoft Surface Hub 2 SmCamera User Manual

Page 517

Advertising
background image

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

}
catch {}

if

($easpolicy)

{

if

(!$easpolicy.PasswordEnabled

-and

($easpolicy.AllowNonProvisionableDevices -eq

$null

-or

$easpolicy.AllowNonProvisionableDevices ))
{
PrintSuccess

"An existing policy has been found and will be applied

to this account."

}

else

{
PrintError

"The policy you provided is incompatible with the surface

hub."

$easpolicy =

$null

$status[

"Device Password Policy"

] =

"Failed to apply the EAS policy

to the account because the policy was invalid."

}
}

else

{
$Error.Clear()
PrintAction

"Creating policy..."

$easpolicy =

New-MobileDeviceMailboxPolicy

-Name

$strPolicy

-

PasswordEnabled

$false

-AllowNonProvisionableDevices

$true

if

($easpolicy)

{
PrintSuccess

"A new device policy has been created; you can use this

same policy for all future Surface Hub device accounts."

}

else

{
PrintError

"Could not create $strPolicy"

}
}

if

($easpolicy)

{

# Convert mailbox to user type so we can apply the policy (necessary)

# Sometimes it takes a while for this change to take affect so we have

some nasty retry loops

$Error.Clear();

try

{

Set-Mailbox

$credNewAccount.UserName

-Type

Regular

Advertising