I need to develop a program in C# find out when was Windows started or shutdown.
Is there a log file that I can read to know Windows start and shutdown times? Or do
You could use the "System Up Time" performance counter to get the start time of the system:
PerformanceCounter systemUpTime = new PerformanceCounter("System", "System Up Time");
systemUpTime.NextValue();
TimeSpan upTimeSpan = TimeSpan.FromSeconds(systemUpTime.NextValue());
Console.Out.WriteLine(DateTime.Now.Subtract(upTimeSpan).ToShortTimeString());
Hope, this helps.