Libraries/Lib.Windows.WinNT.WindowsDesktop/Lib.Windows.WinNT.WindowsDesktop.psm1
<#
Windows Desktop specific library #> <# .SYNOPSIS Get the Codename of the OS .DESCRIPTION For Windows, the codename is of the form #> function Get-OSCodename { [CmdletBinding()][OutputType([String])]Param ( [Parameter(ParameterSetName = 'ONLINE')][switch]$Online, [Parameter(ParameterSetName = 'ROOT')][string]$Root ) Begin { Write-PwShFwOSEnterFunction } Process { switch ($PSCmdlet.ParameterSetName) { 'ONLINE' { $CurrentBuild = Lib.Windows\Get-OSKernelVersion -Online # $ReleaseId = Lib.Windows\Get-OSReleaseID -Online # $DisplayVersion = Lib.Windows.WinNT.Windows\Get-OSReleaseID -Online break } 'ROOT' { $CurrentBuild = Lib.Windows\Get-OSKernelVersion -Root $Root # $ReleaseId = Lib.Windows\Get-OSReleaseID -Root $Root # $DisplayVersion = Lib.Windows.WinNT.Windows\Get-OSReleaseID -Online break } } $value = Get-OSWinDesktopCodenameFromCurrentBuild -CurrentBuild $CurrentBuild return $value } End { Write-PwShFwOSLeaveFunction } } <# .SYNOPSIS Get the Codename of the OS .DESCRIPTION For Windows, the codename is of the form #> function Get-OSLongCodename { [CmdletBinding()][OutputType([String])]Param ( [Parameter(ParameterSetName = 'ONLINE')][switch]$Online, [Parameter(ParameterSetName = 'ROOT')][string]$Root ) Begin { Write-PwShFwOSEnterFunction } Process { switch ($PSCmdlet.ParameterSetName) { 'ONLINE' { $CurrentBuild = Lib.Windows\Get-OSKernelVersion -Online # $ReleaseId = Lib.Windows\Get-OSReleaseID -Online # $DisplayVersion = Lib.Windows.WinNT.Windows\Get-OSReleaseID -Online break } 'ROOT' { $CurrentBuild = Lib.Windows\Get-OSKernelVersion -Root $Root # $ReleaseId = Lib.Windows\Get-OSReleaseID -Root $Root # $DisplayVersion = Lib.Windows.WinNT.Windows\Get-OSReleaseID -Online break } } $value = Get-OSWinDesktopLongCodenameFromCurrentBuild -CurrentBuild $CurrentBuild return $value } End { Write-PwShFwOSLeaveFunction } } function Get-OSWinDesktopCodenameFromCurrentBuild { param ( [Parameter(Mandatory = $true)] [int]$CurrentBuild ) switch ($CurrentBuild) { # Windows 11 26100 { return "Windows 11 24H2" } 22631 { return "Windows 11 23H2" } 22621 { return "Windows 11 22H2" } 22000 { return "Windows 11 21H2" } # Windows 10 19045 { return "Windows 10 22H2" } 19044 { return "Windows 10 21H2" } 19043 { return "Windows 10 21H1" } 19042 { return "Windows 10 20H2" } 19041 { return "Windows 10 2004" } 18363 { return "Windows 10 1909" } 18362 { return "Windows 10 1903" } 17763 { return "Windows 10 1809" } 17134 { return "Windows 10 1803" } 16299 { return "Windows 10 1709" } 15063 { return "Windows 10 1703" } 14393 { return "Windows 10 1607" } 10586 { return "Windows 10 1511" } 10240 { return "Windows 10 1507" } # Windows 8.x 9600 { return "Windows 8.1" } 9200 { return "Windows 8.0" } # Windows 7 7601 { return "Windows 7 SP1" } 7600 { return "Windows 7" } # Windows Vista 6002 { return "Windows Vista SP2" } 6001 { return "Windows Vista SP1" } 6000 { return "Windows Vista" } # Windows XP 3790 { return "Windows XP Professional x64" } 2600 { return "Windows XP" } # Windows 2000 2195 { return "Windows 2000" } # Windows NT 4.0 1381 { return "Windows NT 4.0" } # Windows NT 3.x 528 { return "Windows NT 3.51" } 511 { return "Windows NT 3.5" } 403 { return "Windows NT 3.1" } default { Write-Warning "Unknown build number: $CurrentBuild" return "Windows Client ? ?" } } } function Get-OSWinDesktopLongCodenameFromCurrentBuild { param ( [Parameter(Mandatory = $true)] [int]$CurrentBuild ) switch ($CurrentBuild) { # Windows 11 26100 { return "Windows 11 24H2" } 22631 { return "Windows 11 23H2" } 22621 { return "Windows 11 22H2" } 22000 { return "Windows 11 21H2" } # Windows 10 19045 { return "Windows 10 22H2" } 19044 { return "Windows 10 21H2" } 19043 { return "Windows 10 21H1" } 19042 { return "Windows 10 20H2" } 19041 { return "Windows 10 2004" } 18363 { return "Windows 10 1909" } 18362 { return "Windows 10 1903" } 17763 { return "Windows 10 1809" } 17134 { return "Windows 10 1803" } 16299 { return "Windows 10 1709" } 15063 { return "Windows 10 1703" } 14393 { return "Windows 10 1607 (Anniversary Update)" } 10586 { return "Windows 10 1511 (November Update)" } 10240 { return "Windows 10 1507 (RTM)" } # Windows 8.x 9600 { return "Windows 8.1 (Blue) Update 1" } 9200 { return "Windows 8.0 (RTM)" } # Windows 7 7601 { return "Windows 7 SP1" } 7600 { return "Windows 7 RTM" } # Windows Vista 6002 { return "Windows Vista SP2" } 6001 { return "Windows Vista SP1" } 6000 { return "Windows Vista RTM" } # Windows XP 3790 { return "Windows XP Professional x64 / Server 2003" } 2600 { return "Windows XP 32-bit (RTM/SP1/SP2/SP3)" } # Windows 2000 2195 { return "Windows 2000" } # Windows NT 4.0 1381 { return "Windows NT 4.0" } # Windows NT 3.x 528 { return "Windows NT 3.51" } 511 { return "Windows NT 3.5" } 403 { return "Windows NT 3.1" } default { Write-Warning "Unknown build number: $CurrentBuild" return "Windows Client ? ?" } } } |