the main problem is that windows will in some future disable to modify users password like this method below, and I need to get some other approach beside this one.
static void batchCMD(string user, string newPass)
{
try
{
Process cmdProcess = new Process();
cmdProcess.StartInfo.FileName = "cmd.exe";
if (System.Environment.OSVersion.Version.Major >= 6)
{
cmdProcess.StartInfo.Verb = "runas";
}
cmdProcess.StartInfo.CreateNoWindow = true;
cmdProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
cmdProcess.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
cmdProcess.StartInfo.Arguments = "/c net user " + user + " " + newPass;
cmdProcess.Start();
cmdProcess.WaitForExit(10000);
return;
}
catch (Exception)
{
throw;
}
finally
{
File.WriteAllText(@"C:\temp\txt.log", DateTime.Now + " " + "HIUHIUHIUH" + "\n");
}
}
If you have some other and better solution please share with me.