Monday 2 February 2015

How to connect to Lync Server remotely from Windows PowerShell

Open a Notepad and save the below script and save the file as .PS1

************************************************************************************
# get creds for remote environment
$credential = get-credential "Domain\SamAccountName"
# set session options to bypass the PKI checks - I trust the far side
$sessionoption = New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck
#create new session
$session = New-PSSession -ConnectionUri https://Server.domain.com/ocspowershell -Credential  $credential -SessionOption $sessionOption

# assuming the above line worked, import the cmdlets needed for Lync
import-pssession $session | FT -wrap

**************************************************************************************

Note: If you are trying to connect to Lync Server 2013 server, then ensure your Windows PowerShell is having 3.0 version


No comments:

Post a Comment