Search code examples
powershellpowershell-core

Get Windows "codename"


Is there a PowerShell command that will retrieve the Windows "codename"?

10.0.19042 has a "codename" of "20H2".

Is there a Get-CimInstance class (or other command) that contains "20H2"?

PS C:\> $PSVersionTable.PSVersion.ToString()
7.3.2

Solution

  • Starting with 20H2, you can find this value in the registry key Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion In the DisplayVersion value.

    (Get-Item "HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion").GetValue('DisplayVersion')