Click here to Skip to main content
15,878,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

C#
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

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:
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900