Microsoft Surface Hub 2 SmCamera User Manual

Page 525

Advertising
background image

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[

"ActiveSync 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

} catch {}

if

($Error)

{
$Error.Clear()
$status[

"Device Password Policy"

] =

"Failed to apply the EAS policy

to the account."

PrintError

"Failed to convert to regular account"

}

else

Advertising