/build/static/layout/Breadcrumb_cap_w.png

Show computers Windows 10 build history

Hi everybody,

here is a small one-liner to find out what Windows 10 builds a machine ran in the past and when it was upgraded to which build.
You can call it the improved version of my earlier blog post regarding this topic.

Update: thank you Timo for pointing out that the build output might have been unsorted. New script below takes care of that.

This is the PowerShell code that grabs the information:

$winBuilds = @{}
$regKeys = Get-ChildItem -Path 'HKLM:\SYSTEM\Setup' | Where-Object -FilterScript {($_.Name -like '*Source OS *')}
foreach($uKey in $regKeys)
{
    $winBuilds.Add((Get-ItemProperty -Path $uKey.PSPath -Name ReleaseId).ReleaseId,(Get-ItemProperty -Path $uKey.PSPath -Name InstallDate).InstallDate)
}
$winBuilds.Add((Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' -Name ReleaseId).ReleaseId,(Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' -Name InstallDate).InstallDate)
foreach($item in $winBuilds.GetEnumerator() | Sort Name)
{
    Write-Host "Build $($item.Name) - $([timezone]::CurrentTimeZone.ToLocalTime(([datetime]'1/1/1970').AddSeconds($item.Value)))"
}


To grab this as a custom inventory field in your KACE SMA it can be melted down to:

ShellCommandTextReturn(%windir%\SysNative\WindowsPowerShell\v1.0\powershell -NoLogo -NonInteractive -NoProfile -command "$winBuilds = @{};Get-ChildItem -Path 'HKLM:\SYSTEM\Setup' | Where-Object -FilterScript {($_.Name -like '*Source OS *')}|foreach-object -process {$winBuilds.Add((Get-ItemProperty -Path $_.PSPath -Name ReleaseId).ReleaseId,(Get-ItemProperty -Path $_.PSPath -Name InstallDate).InstallDate)};$winBuilds.Add((Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' -Name ReleaseId).ReleaseId,(Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' -Name InstallDate).InstallDate);foreach($item in $winBuilds.GetEnumerator() | Sort Name){Write-Host "Build $($item.Name) - $([timezone]::CurrentTimeZone.ToLocalTime(([datetime]'1/1/1970').AddSeconds($item.Value)))"}")

Be sure to use the SysNative-call of powershell.exe to avoid problems with the KACE agents 32/64-bit-view-of-things!


Comments

  • This is pure awesome. I instantly created a report for this ! - Timokirch 5 years ago
  • Very interresting, thank you ! - gwir 4 years ago
This post is locked
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ