I got this post at run mstsc.exe but if we supply port number it is not working.
Here is my code with port number change.
Process rdcProcess = new Process();
rdcProcess.StartInfo.FileName = Environment.ExpandEnvironmentVariables(@"%SystemRoot%\system32\cmdkey.exe");
rdcProcess.StartInfo.Arguments = "/generic:TERMSRV/192.168.0.217:123 /user:" + "username" + " /pass:" + "password";
rdcProcess.Start();
rdcProcess.StartInfo.FileName = Environment.ExpandEnvironmentVariables(@"%SystemRoot%\system32\mstsc.exe");
rdcProcess.StartInfo.Arguments = "/v " + "192.168.0.217:123"; // ip or name of computer to connect
rdcProcess.Start();
I have here 123 port number supply with server name. If server is supply without port number all good.
Please suggest any workaround for this.