Microsoft Surface Hub 2 SmCamera User Manual
Page 518

} catch {}
if
($Error)
{
$Error.Clear()
$status[
"Device Password Policy"
] =
"Failed to apply the EAS policy
to the account."
}
else
{
# Loop until resource type goes away, up to 5 times
for
($i = 0; $i -lt 5
-And
(
Get-Mailbox
$credNewAccount.UserName).ResourceType; $i++)
{
Start-Sleep
-s
5
}
# If the mailbox is still a Room we cannot apply the policy
if
(!((
Get-Mailbox
$credNewAccount.UserName).ResourceType))
{
$Error.Clear()
# Set policy for account
Set-CASMailbox
$credNewAccount.UserName
-ActiveSyncMailboxPolicy
$strPolicy
if
(!$Error)
{
$status[
"ActiveSync Policy"
] =
"Successfully applied
$strPolicy to the account"
}
else
{
$status[
"ActiveSync Policy"
] =
"Failed to apply the EAS
policy to the account."
}
$Error.Clear()
# Convert back to room mailbox
Set-Mailbox
$credNewAccount.UserName
-Type
Room
# Loop until resource type goes back to room
for
($i = 0; ($i -lt 5)
-And
((
Get-Mailbox
$credNewAccount.UserName).ResourceType -ne
"Room"
); $i++)
{
Start-Sleep
-s
5
}
if
((
Get-Mailbox
$credNewAccount.UserName).ResourceType -ne
"Room"
)
{
# A failure to convert the mailbox back to a room is
unfortunate but means the mailbox is unusable.
$status[
"Mailbox Setup"
] =
"A mailbox was created but we
could not set it to a room resource type."
}
else
{
try
{
Set-Mailbox
$credNewAccount.UserName
-