From b4607d738f2ee439b415bb63a232f2c3a214d8e4 Mon Sep 17 00:00:00 2001 From: AU-Mark <167436500+AU-Mark@users.noreply.github.com> Date: Tue, 2 Jul 2024 16:32:24 -0400 Subject: [PATCH] Fix ProductName Bug Fixed an issue where the ProductName shows as Windows 10 when its really Windows 11. This was by design by Microsoft. It's recommended to pull the ProductName directly from WMI or from winbrand.dll. --- Project/MainWindow.ps1 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Project/MainWindow.ps1 b/Project/MainWindow.ps1 index 0ab581f..3811611 100644 --- a/Project/MainWindow.ps1 +++ b/Project/MainWindow.ps1 @@ -317,7 +317,12 @@ $formMainWindowControlHeading.Content = $Global:AutopilotOOBE.Title #================================================ $Global:GetRegCurrentVersion = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' -$SubTitleProductName = ($Global:GetRegCurrentVersion).ProductName +# This will no longer be accurate with Windows 11 by design as described here: +# https://learn.microsoft.com/en-us/answers/questions/555857/windows-11-product-name-in-registry?page=2 +# $SubTitleProductName = ($Global:GetRegCurrentVersion).ProductName + +# Instead we will pull the name directly from WMI with Get-CimInstance and remove Microsoft from the beginning of the string +$SubTitleProductName = ((Get-CimInstance Win32_OperatingSystem).Caption).Replace('Microsoft ','') if ($Global:GetRegCurrentVersion.DisplayVersion -gt 0) { $SubTitleDisplayVersion = ($Global:GetRegCurrentVersion).DisplayVersion @@ -790,4 +795,4 @@ Hide-PowershellWindow ########################## $jobCleanup.Flag = $false #Stop Cleaning Jobs $jobCleanup.PowerShell.Runspace.Close() #Close the runspace -$jobCleanup.PowerShell.Dispose() #Remove the runspace from memory \ No newline at end of file +$jobCleanup.PowerShell.Dispose() #Remove the runspace from memory