Monday, June 2, 2014

Import lync module to a remote system


Error
 
While running the command shooting the error
 
PS C:\Windows\System32\WindowsPowerShell\v1.0> Import-module Lync

Import-Module : The specified module 'Lync' was not loaded because no valid mod

ule file was found in any module directory.

At line:1 char:14

+ Import-module <<<<  Lync

    + CategoryInfo          : ResourceUnavailable: (Lync:String) [Import-Modul

   e], FileNotFoundException

    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Comm

ands.ImportModuleCommand
 
The issue is with the Module not installed to the powershell in which the  script runs.
 
Solution
 
Run the below commands on  the system where you want to excicute Lync commands
 
$cred = Get-Credential “Domain\Username”
$sessionoption = new-pssessionoption -SkipRevocationCheck -SkipCAcheck -skipCNcheck
$session = New-PSSession -ConnectionUri
https://<LyncAdminURL>/ocspowershell -credential $cred -SessionOption $sessionoption
IMport-Pssession $session


LyncAdminURL=the url used for the Lync admin console
“Domain\Username” =the user name which is having the required privilige,The command will prompt for the password
Note : Ensure that the Certificate Authority is a trusted Third Party CA on your workstation,otherwise install the certificate




 

No comments:

Post a Comment