Search code examples
.netlync-2013

How to Programatically Sign User In to Response Group


I tried this with the following command:

$x = Get-CsRgsAgentGroup -Identity service:ApplicationServer:LyncFEG.DOMAIN.co.uk/6156f51c-f0b3-4685-b7cc-2b1282a76548 -Name 'ITSupport'
$x.AgentsByUri.Add("sip:[email protected]")
Set-CsRgsAgentGroup -Instance $x

But this appear to have no effect.

I can see that the user I am interested in is already in the group when I call $x.AgentsByUri:

AbsolutePath   : [email protected]
AbsoluteUri    : sip:[email protected]
LocalPath      : [email protected]
Authority      : 
HostNameType   : Unknown
IsDefaultPort  : True
IsFile         : False
IsLoopback     : False
PathAndQuery   : [email protected]
Segments       : {[email protected]}
IsUnc          : False
Host           : 
Port           : -1
Query          : 
Fragment       : 
Scheme         : sip
OriginalString : sip:[email protected]
DnsSafeHost    : 
IdnHost        : 
IsAbsoluteUri  : True
UserEscaped    : False
UserInfo       : 

But when I check their response group settings manually (via skype), I can see that they are not 'signed in' to that group, so they are not receiving any calls made to the group:

enter image description here

I also compared those properties to those of a user who is 'signed in', and they look exactly the same.

Finally, I tried removing the user from the group before adding them (with first method mentioned), but this has no effect.

Is it possible to sign a Lync 2013 user into their call response group using PowerShell?


Solution

  • One way of doing this would be to run the following JSCript:

    var ie = WSH.CreateObject('InternetExplorer.Application');
        url = "https://LYNCSERVER/RgsClients/Tab.aspx",
    
    ie.visible = true;
    ie.Navigate(url);
    while (ie.readyState != 4) WSH.Sleep(25);
    
    ie.document.getElementById('ctl05_ctl00_ctl04_ctl00_ctl00_ctl01').click();
    ie.quit()
    

    Where 'ctl05_ctl00_ctl04_ctl00_ctl00_ctl01' is the ID of the checkbox which signs the user in to the required response group (in this case, IT Support).

    This solution does work quite well, but I would rather not use it as:

    1. It interacts with the UI of a browser rather than directly with the Lync server, SDK or API (still not sure if this is possible) - this doesn't seem like the ideal method.

    2. This script would need to run individually on each user's PC (unless we could implement some sort of impersonation), where I would prefer a solution which can be run centrally.