Artin Artin

Artin Artin

  • NA
  • 1
  • 6.9k

C# Remote Process username and password incorrect

Jun 4 2015 5:09 AM
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();

Answers (2)