If you use both Orchestrator and Microsoft Lync, you have probably wished there was some sort of integration pack for Lync. This would be fantastic, however, since it does not exist currently, I have a great solution. Orchestrator Run .Net Activity and PowerShell remoting. I’m sure I’m not the first to figure this out, as there are lots of people out there smarter than me and have been using Orchestrator and PowerShell longer than me, but unless my googlefu fails me I could not find anyone doing anything in Lync from Orchestrator. I searched for literally days looking for anything. I finally found someone that posted how to do PowerShell remoting with Lync. From there it was trying it in the Run .Net Script activity in Orchestrator. Once this was working, my mind went racing with ideas as there are a number of tasks that can easily be automated in Lync. Remember, if it can be repeated, it can be automated.
The code is really rather simple:
$RunAsAccount = “Subscribed variable”
$RunAsPass = “subscribed encrypted variable”
$pass = $RunAsPass | ConvertTo-SecureString -AsPlainText -Force
$credentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $RunAsAccount, $pass
$session = New-PSSession -ConnectionUri https://FQDN/OcsPowershell -Credential $credentials
insert commands here
Where subscribed variable is the domainnameusername with Lync access
Subscribed encrypted variable is the encrypted password for the aforementioned account.
And FQDN is your fully qualified domain name of the Lync server.
You do need to make sure that PowerShell remoting is enabled on your lync server with the correct WinRM settings. You can read more on that here http://technet.microsoft.com/en-us/magazine/ff700227.aspx
After I had this enabled and started working with it one of the cool things I did was put in a self service request in Service Manager for the IT department to put in a request to get all Assigned DIDs in Lync across the organization. Credit to Chris Hayward for the command (WeakestLync)
Get-Csuser | Select-Object DisplayName, SipAddress, EnterpriseVoiceEnabled, LineUri | Export-Csv -Path E:RunbookOutputLyncLyncUsers.csv
I have it drop the CSV file on a local drive and then Orchestrator grabs it and sends it in email to the requested user.
Here is my runbook that I use. The request comes from the Self-Service portal where the user enters the email they want the CSV sent to.
You can use this same method to automate anything in Lync, I have used it to enable users for Lync, enabled enterprise voice, assign them a DID etc.
This was tested in Lync 2010, some of the settings and or configuration may be a little different in Lync 2013.
This runbook is provided as an example and is not production ready, please test in your own environment. The runbook is provided as is and without warranty.
You can download the runbook here
Hi, I’m Billy York. I’m a Cloud and Datacenter Engineer, specializing in monitoring and automation. Here you’ll find posts about System Center Operations Manager, Powershell, Hyper-V, Azure Automation, Azure Log Analytics and other Microsoft related technologies.