Correct
Get-ComputerInfo outputs the correct OSName
 Get-ComputerInfo | Select-Object OSName,OSDisplayVersion
OsName                          OSDisplayVersion
------                          ----------------
Microsoft Windows 11 Enterprise 24H2
Using Format-List
 Get-ComputerInfo | fl OSName,OSDisplayVersion
OsName           : Microsoft Windows 11 Enterprise
OSDisplayVersion : 24H2
Incorrect
(Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion") | Select-Object -Property ProductName,DisplayVersion                                                                                                                                                
                  
This looks like a solution but the output is incorrect the ProductName says "Windows 10 Enterprise" and should be Windows 11 Enterprise
ProductName           DisplayVersion
-----------           --------------
Windows 10 Enterprise 24H2

0 Comments