Exploring Lync Client 2013 Using PowerShell
Pre-requisites
- Lync 2013 SDK - Download Link
- PowerShell
- Lync 2013
Supported OS
- Windows 7 with Service Pack 1
- Windows 8/8.1/10
Exploring DLL
Once the installation is complete the Microsoft.Lync.Model.dll appears in the path C:\Program Files (x86)\Microsoft Office\Office15\LyncSDK\Assemblies\Desktop It's in the x86 folder because Lync Client is a 32-bit version.
Consuming the DLL in PowerShell
Import-Module "C:\Program Files (x86)\Microsoft Office\Office15\LyncSDK\Assemblies\Desktop\Microsoft.Lync.Model.dll"
#OR Add-Type -Path "C:\Program Files (x86)\Microsoft Office\Office15\LyncSDK\Assemblies\Desktop\Microsoft.Lync.Model.dll" |
Now, we have the DLL loaded so we can invoke the client.
$LyncClient = [Microsoft.Lync.Model.LyncClient]::GetClient(); |
No matter if Lync is signed in or not, but Lync is signed in or off.
#Invoke Lync Client
$LyncClient = [Microsoft.Lync.Model.LyncClient]::GetClient();
#Explore the Lync 2013 Properties $LyncClient | Get-Member -MemberType Property |
Explore Lync 2013 Client Settings
#Explore the Sign in Confiuration
$LyncClient.SignInConfiguration |
Sample Code
Import-Module "C:\Program Files (x86)\Microsoft Office\Office15\LyncSDK\Assemblies\Desktop\Microsoft.Lync.Model.dll"
#OR Add-Type -Path "C:\Program Files (x86)\Microsoft Office\Office15\LyncSDK\Assemblies\Desktop\Microsoft.Lync.Model.dll"
#Invoke Lync Client $LyncClient = [Microsoft.Lync.Model.LyncClient]::GetClient();
#Explore Settings - Full Code $LyncClient.Capabilities
#Exploring Contacts $LyncClient.ContactManager
#Self - Current User Logged On $LyncClient.Self.Contact.Uri
#Current State of Lync Client $LyncClient.State
$LyncClient.SignInDelayed
#Toggle Password save settings $LyncClient.SignInConfiguration.IsPasswordSaved = $true $LyncClient.SignInConfiguration.IsPasswordSaved = $false
#Explore Capabilities $LyncClient.Capabilities
#Check your Exchange ECP URL $LyncClient.Utilities.ExchangeECPUrl
#Add Group $contact = $LyncClient.ContactManager.BeginAddGroup('Test Group' , $null , $null) |
Screenshots
See Also