Libraries/Lib.Windows.Winnt.Windows.Windowspe/Lib.Windows.Winnt.Windows.Windowspe.psm1
<#
.SYNOPSIS Get the Codename of the OS .DESCRIPTION For Windows PE, the codename is of the form WinPE<MAJOR>.<RELEASEID> e.g. WinPE5 WinPE10.1903 WinPE11.24H2 #> 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-OSWinPECodenameFromCurrentBuild -CurrentBuild $CurrentBuild return $value } End { Write-PwShFwOSLeaveFunction } } function Get-OSWinPECodenameFromCurrentBuild { param ( [Parameter(Mandatory = $true)] [int]$CurrentBuild ) switch ($CurrentBuild) { # WinPE 11 22631 { return "WinPE11.23H2" } 22621 { return "WinPE11.22H2" } 22000 { return "WinPE11.21H2" } # Windows Server 2022 base 20348 { return "WinPE2022.21H2" } # WinPE 10 19045 { return "WinPE10.22H2" } 19044 { return "WinPE10.21H2" } 19043 { return "WinPE10.21H1" } 19042 { return "WinPE10.20H2" } 19041 { return "WinPE10.2004" } 18363 { return "WinPE10.1909" } 18362 { return "WinPE10.1903" } 17763 { return "WinPE10.1809" } 17134 { return "WinPE10.1803" } 16299 { return "WinPE10.1709" } 15063 { return "WinPE10.1703" } 14393 { return "WinPE10.1607" } 10586 { return "WinPE10.1511" } 10240 { return "WinPE10.1507" } # WinPE 5.x (Windows 8.1) 9600 { return "WinPE5.0" } # WinPE 4.x (Windows 8) 9200 { return "WinPE4.0" } # WinPE 3.x (Windows 7 SP1, RTM) 7601 { return "WinPE3.1" } 7600 { return "WinPE3.0" } # WinPE 2.x (Vista / 2008) 6002 { return "WinPE2.1" } 6001 { return "WinPE2.0" } default { Write-Warning "Build inconnu : $CurrentBuild" return "WinPE?.?" } } } <# .SYNOPSIS Get the Codename of the OS .DESCRIPTION For Windows PE, the codename is of the form WinPE<MAJOR>.<RELEASEID> e.g. WindowsPE 5 Windows PE 10 1903 Windows PE 11 24H2 #> 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-OSWinPELongCodenameFromCurrentBuild -CurrentBuild $CurrentBuild return $value } End { Write-PwShFwOSLeaveFunction } } function Get-OSWinPELongCodenameFromCurrentBuild { param ( [Parameter(Mandatory = $true)] [int]$CurrentBuild ) switch ($CurrentBuild) { # WinPE 11 22631 { return "WindowsPE 11 23H2" } 22621 { return "WindowsPE 11 22H2" } 22000 { return "WindowsPE 11 21H2" } # Server 2022 20348 { return "WindowsPE 2022 21H2" } # WinPE 10 19045 { return "WindowsPE 10 22H2" } 19044 { return "WindowsPE 10 21H2" } 19043 { return "WindowsPE 10 21H1" } 19042 { return "WindowsPE 10 20H2" } 19041 { return "WindowsPE 10 2004" } 18363 { return "WindowsPE 10 1909" } 18362 { return "WindowsPE 10 1903" } 17763 { return "WindowsPE 10 1809" } 17134 { return "WindowsPE 10 1803" } 16299 { return "WindowsPE 10 1709" } 15063 { return "WindowsPE 10 1703" } 14393 { return "WindowsPE 10 1607" } 10586 { return "WindowsPE 10 1511" } 10240 { return "WindowsPE 10 1507" } # WinPE 5.x (Windows 8.1) 9600 { return "WindowsPE 5" } # WinPE 4.x (Windows 8) 9200 { return "WindowsPE 4" } # WinPE 3.x (Windows 7 SP1, RTM) 7601 { return "WindowsPE 3.1" } 7600 { return "WindowsPE 3.0" } # WinPE 2.x (Vista / 2008) 6002 { return "WindowsPE 2.2" } 6001 { return "WindowsPE 2.1" } default { Write-Warning "Build inconnu : $CurrentBuild" return "WindowsPE ? ?" } } } |