0

My question is little special to my situation. I have done some research but maybe i'm doing some errors. I want to change user (not admin) password in C# and i want to change the password 's indication (text to remenber password) in the same time. All that in C#. I have write codes that works when i'm in admin account but not in user account, i don't know why. That is my code :

//conversion password to secure password start
string password = "admin";
System.Security.SecureString sec_pass = new System.Security.SecureString();
Array.ForEach(password.ToArray(), sec_pass.AppendChar);
sec_pass.MakeReadOnly();

//End of conversion 

System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo();
psi.Verb = "runas";
psi.FileName = "cmd.exe";
psi.UseShellExecute = false;
psi.Password = sec_pass;
psi.Arguments = "/C net user Utilisateur new";
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo = psi;
p.Start();

My user is called Utilisateur and my admin password is admin

In this code i just try to change password, but that does not work. and i don't know how to change the indication text. If some one may help me go throw.

Thanks

Yael
  • 1,566
  • 3
  • 18
  • 25
Zogre
  • 73
  • 1
  • 1
  • 10
  • [This thread](http://stackoverflow.com/questions/4253893/how-to-change-password-to-user-account-by-c-sharp-code) might help you with the password changing. Not sure about the password hint mind. – Octopoid Sep 23 '15 at 08:44
  • Thanks Octopoid, i'm going to see it – Zogre Sep 23 '15 at 08:55
  • I have forgot to add that i am not in domain. it is a local account. – Zogre Sep 23 '15 at 09:02
  • I have find the answer for the first question. I miss this line of code psi.UserName = "Administrateur"; to specify the user. Make sure also that the password is not empty. Still the second question. how to modify password's indication – Zogre Sep 23 '15 at 09:49

0 Answers0