Click here to Skip to main content
14,357,792 members
Rate this:
Please Sign up or sign in to vote.
Hello i'm try to get procceses to Remote Computer in my LAN network , i set all of the property good i know username and password but when i try to connect it give back to me

System.ComponentModel.Win32Exception (0x80004005): The user name or password is incorrect;

i type the right Username and Password with administrative rights what do u think ?

That is my code

const string file = "cmd.exe";

        var sspw = new SecureString();

        foreach (var c in "password")
            sspw.AppendChar(c);

        var proc = new Process();

        proc.StartInfo.UseShellExecute = false;

        proc.StartInfo.WorkingDirectory = Path.GetDirectoryName(file);

        proc.StartInfo.FileName = Path.GetFileName(file);

        proc.StartInfo.Domain = "REMOTEPC";
        proc.StartInfo.Arguments = "";
        proc.StartInfo.UserName = "username";
        proc.StartInfo.Password = sspw;
        proc.StartInfo.LoadUserProfile = false;
        proc.Start();
Posted
Comments
F-ES Sitecore 4-Jun-15 5:48am
   
Try adding the domain to the username

yourdomain\username

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

That code will try to start a process on your computer under a local user account from the remote computer. Since the account is local to the other computer, it won't work on your computer. And from the description, that's not what you're trying to do anyway.

To launch a process on the remote computer, you have several options:
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100