Lync 2010 Powershell Modules

When working with a Powershell Workflow for FIM I needed to have Lync 2010 powershell modules installed locally on my FIM server. This was actually really easy to achieve. But at first glance I couldn`t find out where/how to get hold of the Lync modules.

So. After alot of googling. I found out that the only way to get the Lync modules (as I could see) into my local machine was to install the ocscore.msi packaged that is in the Lync 2010 install kit. You`ll find ocscore.msi here – %Setup\amd64\Setupocscore.msi
To get the Lync 2010 install kit, you can download the trial version here

When installed you got the Lync modules here: C\:Program Files\Common Files\Microsoft Lync Server 2010\Modules
If your need all users of the computer to have access to the modules. Copy the “Lync” folder to this location: C:\Windows\System32\WindowsPowerShell\v1.0\Modules\Lync

So. After this is done. Just run “Import-Module Lync” in your PowerShell!

Have fun!

  • es5ape


  • Eihab

    Thanks for the post.

    I have granted FIM Service Service account the required permissions to enable lync.

    When I run my script using powershell, the lync account gets enabled. However, when running the script from the workflow activity, it throws an exception. Did that happen to you?

    ERROR: Active Directory operation failed on “DC.Company.Com”. You cannot retry this operation: “Insufficient access rights to perform the operation 00002098: SecErr: DSID-03150BB9, problem 4003 (INSUFF_ACCESS_RIGHTS), data 0

  • Remi

    Hello Eihab!

    Did you try to run the PS script as FIMService service account, just to make sure you have the correct permissions?

    This is the PS script im using in production right now:
    $session = New-PSSession -ConnectionUri ‘https://DNSTOLYNCSERVER/ocspowershell’ -Authentication Negotiate
    Import-PSSession $session -CommandName Set-CSUser, Enable-CSUser, Disable-CSUser
    Enable-CsUser -Identity $FimWF.workflowDictionary.brukernavn -RegistrarPool DNSTOLYNCSERVER -SipAddressType EmailAddress

  • Eihab

    Hi Remi,

    When I login to the server using FIM Service, and run the script using powershell, it works. However, when running the script from the workflow activity it doesn’t work.

    Any idea of why this is happening?

    Thanks for your response.

  • Eihab

    I fixed it, and here is what I did.

    I removed FIM Service Service Account from “Deny Access As Batch Job” local security policy, and restarted the server.

  • Remi

    Hi Eihab,
    I was just sitting down to look at this. Perfect! Thanks for getting back! Btw. love your UI work! 🙂

  • Eihab

    Thank you Remi,, I’m glad you like it.. This is why we post stuff, to help each others out. I guess without your post, i wouldn’t have figured it out 😀

  • roni nuriel

    i tried and didn’t work 🙁
    i get error : the assembly ‘’ was not loaded because no assembly was found
    why it didn’t work??? any idea?

  • Remi

    Hello Roni,
    When/where are you getting this error?

  • roni nuriel


    i installed ocscore.msi.
    in powershell (v.3) i run “Import-Module Lync” and ger this error

  • Remi

    Hm. I have not tried this in Poweshell v3.0. Maybe this will help you: