我能够找到LastTimeSync,但无论设置是否启用,都找不到。
ProcessStartInfo psi = new ProcessStartInfo("w32tm"," /query /status");
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.CreateNoWindow = true;
var proc = System.Diagnostics.Process.Start(psi);
string s = proc.StandardOutput.ReadToEnd();
s = s.Substring(s.LastIndexOf("Last"));
s = s.Remove(s.LastIndexOf("Source"));