Run a process remotely using System.Diagnostics.Process

I am working on an ASP.net application. I am trying to execute a process remotely using the System.Diagnostics.Process class

here is my code:

ProcessStartInfo startInfo = new ProcessStartInfo(@"C:\TestCommand.exe");

            startInfo.Domain = "myDomain";
            startInfo.UserName = "MyUserName";
            SecureString sec = new SecureString();

            foreach (char item in "MyPassword")
            {
                sec.AppendChar(item);                
            }
            sec.MakeReadOnly();


            startInfo.Password = sec;

            startInfo.UseShellExecute = false;
            Process.Start(startInfo);

I keep getting an exception with the message "Login failed: unknown username or invalid password." Im absolutelly sure i submit my correct username / pwd

Am I missing something here?

Tks

+3
source share
1 answer

Ups, wrong domain: P

+1
source

Source: https://habr.com/ru/post/1734570/


All Articles