With the C# Core 3.1 WinForms application, the first installation date of the operating system cannot be read through regedit. It gives different results than the date given by "SystemInfo" command with CMD.
CMD "System Info":
Original Install Date: 11/26/2022, 1:08:26 PM
C# Read a "Regedit InstallDate(DWord)":
Date: "1.01.1601 00:02:46"
RegistryKey key = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, computerName);
key = key.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion", false);
if (key != null)
{
DateTime installDate =
DateTime.FromFileTimeUtc(
Convert.ToInt64(
key.GetValue("InstallDate").ToString()));
return installDate;
}
return DateTime.MinValue;