I am running the below from c#
vpncmd is in c:\windows\system32
running the vpncmd command string works fine when I run in the command prompt
If I replace vpncmd with a stock command like "ipconfig /all" it works fine
I have another system running exactly the same command that works fine (the only difference is this server is Windows Server 2016 and the one its working on is Server 2012)
result always comes back as ""
ExecuteCommandBuild("vpncmd <server> /server /hub:<hub> /PASSWORD:<psswd> /cmd iptable");
public void ExecuteCommandBuild(object command)
{
try
{
System.Diagnostics.ProcessStartInfo procStartInfo =
new System.Diagnostics.ProcessStartInfo("cmd", "/c " + command);
procStartInfo.RedirectStandardOutput = true;
procStartInfo.UseShellExecute = false;
procStartInfo.CreateNoWindow = true;
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo = procStartInfo;
proc.Start();
string result = proc.StandardOutput.ReadToEnd();
}