UPDATE
#skype4b #powershell Auto Enforce User-defined Lync/Skype Presence Status
———-
You may notice that since the launch of Lync 2010 client to the latest Skype for Business 2016 (desktop) client, user’s manually configured Presence Status automatically reverts to Available after some predetermined time-out period [1]. This is unlike system managed status such as In a call or In a conference* which remains unchanged as long as the session is active (even with a locked computer).
To regain control over presence status set explicitly by hand, you can deploy PowerShell in combination with …
… the Lync 2013 Client SDK. This is the last SDK version that continues to work with the Skype for Business 2016 client. If installing this is not possible due to the system requirements, simply copy the required DLL from a machine with the SDK already installed.
To achieve this goal, consider configuring a scheduled task or start a separate process to check and auto reset your presence status to the desired state with Reset-Skype4bPresenceStatus.ps1 as follows.
Enjoy and have fun!
################################################################################
# Copyright (c) 201x-2017 leedesmond.com
# All Rights Reserved. Use at your own risk and responsibility.
# Reset-Skype4bPresenceStatus.ps1
# Version 1.00
################################################################################
Import-Module “C:\Program Files (x86)\Microsoft Office\Office15\LyncSDK\Assemblies\Desktop\Microsoft.Lync.Controls.dll”;
Import-Module “C:\Program Files (x86)\Microsoft Office\Office15\LyncSDK\Assemblies\Desktop\Microsoft.Lync.Model.dll”;
$lc = [Microsoft.Lync.Model.LyncClient]::GetClient();
$mySipAddr = $lc.self.Contact.Uri;
$mySipAddr = $mySipAddr.SubString($mySipAddr.IndexOf(“:”)+1);
$myContact = $lc.ContactManager.GetContactByUri($mySipAddr);
#3500 Free/Available; 6500 Busy
$myAvailability = $myContact.GetContactInformation(“Availability”);
if ($myAvailability -eq [Microsoft.Lync.Controls.ContactAvailability]::Free)
{
$myAvailability = [Microsoft.Lync.Controls.ContactAvailability]::Busy;
$myContactInfo = New-Object ‘System.Collections.Generic.Dictionary[Microsoft.Lync.Model.PublishableContactInformationType, object]’;
$myContactInfo.Add([Microsoft.Lync.Model.PublishableContactInformationType]::Availability, $myAvailability);
$cInfo = $lc.self.BeginPublishContactInformation($myContactInfo, $null, $null);
$lc.self.EndPublishContactInformation($cInfo);
}
* via ad-hoc “Meet me” or a scheduled meeting (Outlook)
REFERENCES
[1]
Why Does Presence Auto-reset After Manually Selecting Busy or Do Not Disturb?
[2]
Change status of Lync by script
[3]
Finding Lync contact availability using PowerShell
[4]
Microsoft Visual Studio 2010 Shell (Isolated) Redistributable Package (File version: 10.0.30319.1)