Libraries/Lib.Windows.Winnt.WindowsPE/Lib.Windows.Winnt.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 (Windows 11 kernel) 26100 { return "WinPE 11 24H2" } 22631 { return "WinPE 11 23H2" } 22621 { return "WinPE 11 22H2" } 22000 { return "WinPE 11 21H2" } # WinPE 10 (Windows 10 kernel) 19045 { return "WinPE 10 22H2" } 19044 { return "WinPE 10 21H2" } 19043 { return "WinPE 10 21H1" } 19042 { return "WinPE 10 20H2" } 19041 { return "WinPE 10 2004" } 18363 { return "WinPE 10 1909" } 18362 { return "WinPE 10 1903" } 17763 { return "WinPE 10 1809" } 17134 { return "WinPE 10 1803" } 16299 { return "WinPE 10 1709" } 15063 { return "WinPE 10 1703" } 14393 { return "WinPE 10 1607" } 10586 { return "WinPE 10 1511" } 10240 { return "WinPE 10 1507" } # WinPE 5.x (Windows 8.x kernel) 9600 { return "WinPE 5.1" } 9200 { return "WinPE 4.0" } # WinPE 3.x (Windows 7 kernel) 7601 { return "WinPE 3.1" } 7600 { return "WinPE 3.0" } # WinPE 2.x (Vista kernel) 6002 { return "WinPE 2.1" } 6001 { return "WinPE 2.0" } 6000 { return "WinPE 2.0" } # WinPE 1.x (XP/2003 kernel) 3790 { return "WinPE 1.6" } 2600 { return "WinPE 1.5" } 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) { # Windows PE 11 (Windows 11 kernel) 26100 { return "Windows PE 11 24H2" } 22631 { return "Windows PE 11 23H2" } 22621 { return "Windows PE 11 22H2" } 22000 { return "Windows PE 11 21H2" } # Windows PE 10 (Windows 10 kernel) 19045 { return "Windows PE 10 22H2" } 19044 { return "Windows PE 10 21H2" } 19043 { return "Windows PE 10 21H1" } 19042 { return "Windows PE 10 20H2" } 19041 { return "Windows PE 10 2004" } 18363 { return "Windows PE 10 1909" } 18362 { return "Windows PE 10 1903" } 17763 { return "Windows PE 10 1809" } 17134 { return "Windows PE 10 1803" } 16299 { return "Windows PE 10 1709" } 15063 { return "Windows PE 10 1703" } 14393 { return "Windows PE 10 1607" } 10586 { return "Windows PE 10 1511" } 10240 { return "Windows PE 10 1507 (RTM)" } # Windows PE 5.x (Windows 8.x kernel) 9600 { return "Windows PE 5.1 (Windows 8.1 Update 1)" } 9200 { return "Windows PE 4.0 (Windows 8.0 RTM)" } # Windows PE 3.x (Windows 7 kernel) 7601 { return "Windows PE 3.1 (Windows 7 SP1)" } 7600 { return "Windows PE 3.0 (Windows 7 RTM)" } # Windows PE 2.x (Vista kernel) 6002 { return "Windows PE 2.1 (Vista SP2)" } 6001 { return "Windows PE 2.0 (Vista SP1)" } 6000 { return "Windows PE 2.0 (Vista RTM)" } # Windows PE 1.x (XP/2003 kernel) 3790 { return "Windows PE 1.6 (based on XP x64/2003)" } 2600 { return "Windows PE 1.5 (based on XP 32-bit)" } default { Write-Warning "Build inconnu : $CurrentBuild" return "WindowsPE ? ?" } } } |