Friday, March 31, 2017

When was Windows installed?

For different reason, you might want to know when Windows installed.
Luckily you can find this information other places then checking out the date on certain system files that was created/modified and stamped at the same time as when you installed Windows. The file date stamp method does not in calculate that files change this information during upgrades etc. during the lifecycle of the installation 

In registry, you have a Key to help you with this information.
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\InstallDate

In my case I get the value 578f233b in hexadecimal and 1468998459 in decimal value. This number are the value in seconds from 01.01.1970 00:00:00 UTC time (not including leaps seconds, currently 27 leap second have been added with the last been added 31.Des 2016). This is a Unix time method of describing instants in time, for more info check out Wikipedia HERE 

If head calculation is not your favorite, you can use an calculator like THIS

The result shows that my installation was done on the 20th of June 2016.

Faster ways

Still this might be a unnecessary difficult way of finding the needed information. So here are some more efficient ways of getting the information.

Command prompt:

systeminfo|find /i "original"


$osinfo = get-wmiobject win32_operatingsystem
Write-Host "Windows install Date: " ($osinfo.ConvertToDateTime($osinfo.InstallDate) -f "MM/dd/yyyy") 

WMI Query

$path = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion'
$osinstall = get-itemproperty -path $path -name InstallDate
$date = get-date -year 1970 -month 1 -day 1 -hour 0 -minute 0 -second 0
($date.AddSeconds($osinstall.InstallDate)).ToLocalTime().AddHours((get-date -f zz)) -f "MM/dd/yyyy"

Test-MigrationReadyness.ps1 Script

I have added a OneDrive/SharePoint migration related script to my GitHub This is an add-on to make my script " Test-OneDrivePath.ps1...