Hey Y’all,
FYI: I’m posting here because this applies to all versions of Windows or at least 10 & 11 as I don’t have any earlier versions to test.
I was rummaging around in some old Image files and was curious as to which Windows version was active at the time the image was taken. I found out that you can glean that information in the DISM.log file located at d:\Windows\Logs.
That file however is really big so I wrote a short PowerShell program to sift the file for the information. You just provide a drive letter of the mounted image and the program will do the heavy lifting. Note: this will also work on your C: drive if you like.
Clear-Host $DrvLtr = Read-Host -Prompt "Enter Windows System Drive Letter" If ($DRvLtr.Length -eq 1) { $DRvLtr = "$($DRvLtr):" } If ($DrvLtr.Length -ne 2) { "$DrvLtr is an invalid specification use x or x: only." Exit } $DISMLogPath = "$DrvLtr\Windows\Logs\DISM" $DISMFile = Join-path -Path $DISMLogPath -ChildPath "dism.log" $Log = Get-Content -Path $DISMFile $API = $Log | Select-String "API Version" $Last = $API[-1] $Last = $Last -split(":") $Vers = (($Last[4] -split("-"))[0]) #---- OUTPUT ---- CLear-Host $Vers = $Vers -replace("API Version","Windows Build:") "The Windows version mounted at $DrvLtr is:`n $Vers"
Output:
The Windows version mounted at D: is: Windows Build: 10.0.22621.1 PS>
Note: I tested this on both Macrium Reflect and Terabyte Image for Windows Images. Of course it shouldn’t make a different but it’s always good to check!
I’ll probably pretty this up with dialog and message boxes and post it to my shared OneDrive folder at a later date. Let me know if you find it useful.