Windows 10 Setup Keys – Reference

Windows 10 has some great data in the Registry concerning the Windows OS and it’s previous builds.  This can be great for reporting, or troubleshooting.

First off reporting, I’m not going to touch that one much, but Hopefully Sherry K. will be posting something about that topic, or CM will build in native functionality. UserVoice:HERE

For Troubleshooting, I have an entire script that I run, it’s mostly specific to our environment, but I might post most of it sometime..

but a small snip about gathering Current Build, previous Builds and Install Times.

Registry:

HKLM:\SYSTEM\SETUP\SourceOS…
image

HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion
image

Script output:
image

<#
Grabs Current OS Build Info
Grabs OS Upgrade History & Install Dates.
Gary Blok & Thanks Jeff Scripter for help with the sorting.
Thanks Google for the Covert-Function
#>

Function Convert-FromUnixDate ($UnixDate) {
   [timezone]::CurrentTimeZone.ToLocalTime(([datetime]'1/1/1970').AddSeconds($UnixDate))
}

[Microsoft.Win32.RegistryKey[]]$UpgradeHistory  = Get-Item -Path 'HKLM:\SYSTEM\Setup\Source*'
[Func[Microsoft.Win32.RegistryKey,DateTime]]$SortFunction = {param($Key)[DateTime]::FromFileTime($Key.GetValue('InstallTime'))}

$UpgradeHistory = [System.Linq.Enumerable]::OrderByDescending($UpgradeHistory,$SortFunction)
$CurrentOSInfo = Get-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion'

$InstallDate_CurrentOS = Convert-FromUnixDate $CurrentOSInfo.GetValue('InstallDate')
$ReleaseID_CurrentOS = $CurrentOSInfo.GetValue('ReleaseId')
$BuildUBR_CurrentOS = $($CurrentOSInfo.GetValue('CurrentBuild'))+"."+$($CurrentOSInfo.GetValue('UBR'))

Write-Host "Current OS Inforamtion" -ForegroundColor Gray
Write-Host " Current OS: $ReleaseID_CurrentOS - UBR (now): $BuildUBR_CurrentOS" -ForegroundColor Green
Write-Host "  Orginial Install Date: $InstallDate_CurrentOS" -ForegroundColor Green
if ($UpgradeHistory -ne $null)
    {
    Write-Host "Previous Upgrades" -ForegroundColor Gray
    foreach ($History in $UpgradeHistory)
        {
        $InstallDate__History = Convert-FromUnixDate $History.GetValue('InstallDate')
        $ReleaseID_History = $History.GetValue('ReleaseId')
        $BuildUBR_History =  $($History.GetValue('CurrentBuild'))+"."+$($History.GetValue('UBR'))
        
        
        Write-Host "  Info About: $ReleaseID_History - Last UBR: $BuildUBR_History" -ForegroundColor Green
        Write-Host "   $(($History.Name.Split("(")[1]).Trim(")")) to New Build (See Above)" -ForegroundColor Green
        Write-Host "   Orginial Install Date of $($ReleaseID_History): $InstallDate__History" -ForegroundColor Green
        } 

    }

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.