Reputation: 21
I am developing a wpf application using Lync SDK that sits on a windows 2012R2 server which I access using a remote desktop session. I am trying to keep the lync account logged in to be always available, even when there is no user logged into the computer.
I set a timer to tick every 15 seconds that runs this code:
if (client.State == ClientState.SignedIn)
{
counter++;
Console.WriteLine("Account is green: " + counter);
Dictionary<PublishableContactInformationType, object> status = new Dictionary<PublishableContactInformationType, object>();
status.Add(PublishableContactInformationType.Availability, Microsoft.Lync.Controls.ContactAvailability.Free);
client.Self.BeginPublishContactInformation(status, PublicationCallback, time);
Console.WriteLine(client.Self.Contact.GetContactInformation(ContactInformationType.Activity));
}
While this does set the status of the user to be Available when someone is logged in (even if no one is using the computer), whenever I disconnect from the remote desktop session (and the server locks but is still running), the status goes to away.
Is there some way for me to get it to ignore if the computer is locked or not?
Upvotes: 0
Views: 439
Reputation: 21
Having it ignore locking was solved by a different solution entirely which requires two different things:
Firstly, instead of just closing my remote desktop session, I had to use a command prompt script to leave. Type this into your command prompt in order to log off:
tscon [YOUR SESSION ID] /DEST:console
You can find your session ID by looking into your Windows Task Manager's User page (it might be hidden so you have to display it).
Secondly, you have to have your keyboard occasionally move. There are many scripts that do it but I found this that I liked because it toggles the numlock making the computer still usable when triggered.
Dim objResult
Set objShell = WScript.CreateObject("WScript.Shell")
i = 0
Do While i = 0
objResult = objShell.sendkeys("{NUMLOCK}{NUMLOCK}")
Wscript.Sleep (6000)
Loop
Save this in a .vbs file and run it before you leave your computer. This will prevent any sleep triggered by lack of use that might be set.
Upvotes: 2