0

I need to execute this command on our remote Skype server:

SEFAUtil.exe /server:lyncserver.domain1.co.uk sip:MySelf@domain.com /addteammember:sip:OtherUser@domain.com /delayringteam:10

which adds a colleague to my team call group.

I am able to run the command on the server itself, and the code below works when sending other commands to that server:

var processToRun = new[] { process };
var connection = new ConnectionOptions();
var wmiScope = new ManagementScope(String.Format("\\\\{0}\\root\\cimv2", LyncServer), connection);
var wmiProcess = new ManagementClass(wmiScope, new ManagementPath("Win32_Process"), new ObjectGetOptions());
var reason = wmiProcess.InvokeMethod("Create", processToRun);

However, when process is the string:

"cmd /c cd /d C:\\Program Files\\Microsoft Lync Server 2013\\ResKit && SEFAUtil.exe /server:lyncserver.domain1.co.uk sip:MySelf@domain.com /addteammember:sip:OtherUser@domain.com /delayringteam:10"

Then the user is not added to the team call group.


I can see that reason contains the uint 0, which usually indicates success - but the actual command is clearly failing.

I also tried adding > C:\users\user.name\desktop\output.txt and 2> C:\users\user.name\desktop\output.txt to the end of the command, but they just created empty text files, so not very useful!

Update

I tried changing the command to the following:

const string LyncServer = "server.domain1.co.uk";
const string ResKitPath = @"C:\Program Files\Microsoft Lync Server 2013\ResKit";

var command = "SEFAUtil.exe /server:{LyncServer} sip:MySelf@domain.com /addteammember:sip:OtherUser@domain.com /delayringteam:10"; 
var process = $"cmd /c cd /d \"{ResKitPath}\" && {command}";

So that the path containing spaces is double-quoted and the slashes are not being escaped, but with the same results.

Does anyone know of another way of debugging this or retrieving the output for the newly created process?

Bassie
  • 9,529
  • 8
  • 68
  • 159
  • Not sure that the backslashes need to be escaped. Pretty sure you need to quote the directory path that contains space characters. `cd /d "C:\\Program Files\\Microsoft Lync Server 2013\\ResKit"`. – lit Oct 26 '16 at 20:45
  • @Liturgist I updated my answer where I tried that approach but it doesn't seem to work – Bassie Oct 27 '16 at 08:23

1 Answers1

1

I've had a similar issue, mine was that the command shell needed to run elevated. SEFA is a bit naff at giving good error messages, and fails silently.