Microsoft Surface Hub 2 SmCamera User Manual

Page 523

Advertising
background image

PrintError

"Please install the Windows PowerShell Module for Lync

Online. For more information go to
https://www.microsoft.com/download/details.aspx?id=39366"

PrintError

"Please install the Azure Active Directory module for

PowerShell from https://go.microsoft.com/fwlink/p/?linkid=236297"

CleanupAndFail
}

## Collect account data ##

$credNewAccount = (

Get-Credential

-Message

"Enter the desired UPN and

password for this new account"

)

$strUpn = $credNewAccount.UserName
$strDisplayName =

Read-Host

"Please enter the display name you would like to

use for $strUpn"

if

(!$credNewAccount

-Or

[System.String]::IsNullOrEmpty($strDisplayName)

-Or

[System.String]::IsNullOrEmpty($credNewAccount.UserName)

-Or

$credNewAccount.Password.Length -le 0)
{
CleanupAndFail

"Please enter all of the requested data to continue."

exit

1

}

## Sign in to remote powershell for exchange and lync online ##

$credAdmin =

$null

$credAdmin=

Get-Credential

-Message

"Enter credentials of an Exchange and

Skype for Business admin"

if

(!$credadmin)

{
CleanupAndFail

"Valid admin credentials are required to create and

prepare the account."

}
PrintAction

"Connecting to remote sessions. This can occasionally take a

while - please do not enter input..."

try

{
$sessExchange =

New-PSSession

-ConfigurationName

microsoft.exchange

-

Credential

$credAdmin

-AllowRedirection -Authentication

basic

-ConnectionUri

"https://outlook.office365.com/powershell-liveid/"

-WarningAction

SilentlyContinue
}
catch
{
CleanupAndFail

"Failed to connect to exchange. Please check your

credentials and try again. Error message: $_"

}

try

{
$sessCS =

New-CsOnlineSession

-Credential

$credAdmin

}
catch
{

Advertising