Gaurav Pal

Gaurav Pal

  • NA
  • 306
  • 68.5k

Server Time Change

Jun 25 2015 7:23 AM
Hi Members,

I am using below code in both window App and web app. and copy to my NTP server. window application is run on server but we application not working.

Please help.....

void setTime(string timeInYourSystemFormat)
{
var proc = new System.Diagnostics.ProcessStartInfo();
proc.UseShellExecute = true;
proc.WorkingDirectory = @"C:\Windows\System32";
proc.CreateNoWindow = true;
proc.FileName = @"C:\Windows\System32\cmd.exe";
proc.Verb = "runas";
proc.Arguments = "/C time " + timeInYourSystemFormat;
try
{
System.Diagnostics.Process.Start(proc);
}
catch
{
MessageBox.Show("Error to change time of your system");
Application.ExitThread();
}
}

Answers (1)