Update CaptureFFU.ps1

- Add support for Server Core in SKU name
This commit is contained in:
JonasKloseBW
2024-09-30 16:52:15 +02:00
committed by GitHub
parent 5194133a78
commit f144f1d71c
@@ -12,6 +12,7 @@ reg load "HKLM\FFU" $Software
$SKU = Get-ItemPropertyValue -Path 'HKLM:\FFU\Microsoft\Windows NT\CurrentVersion\' -Name 'EditionID' $SKU = Get-ItemPropertyValue -Path 'HKLM:\FFU\Microsoft\Windows NT\CurrentVersion\' -Name 'EditionID'
[int]$CurrentBuild = Get-ItemPropertyValue -Path 'HKLM:\FFU\Microsoft\Windows NT\CurrentVersion\' -Name 'CurrentBuild' [int]$CurrentBuild = Get-ItemPropertyValue -Path 'HKLM:\FFU\Microsoft\Windows NT\CurrentVersion\' -Name 'CurrentBuild'
$DisplayVersion = Get-ItemPropertyValue -Path 'HKLM:\FFU\Microsoft\Windows NT\CurrentVersion\' -Name 'DisplayVersion' $DisplayVersion = Get-ItemPropertyValue -Path 'HKLM:\FFU\Microsoft\Windows NT\CurrentVersion\' -Name 'DisplayVersion'
$InstallationType = Get-ItemPropertyValue -Path 'HKLM:\FFU\Microsoft\Windows NT\CurrentVersion\' -Name 'InstallationType'
$BuildDate = Get-Date -uformat %b%Y $BuildDate = Get-Date -uformat %b%Y
$SKU = switch ($SKU) { $SKU = switch ($SKU) {
@@ -32,7 +33,7 @@ $SKU = switch ($SKU) {
ServerDatacenter { 'Srv_Dtc' } ServerDatacenter { 'Srv_Dtc' }
} }
if ($SKU -notmatch "Srv") { if ($InstallationType -eq "Client") {
if ($CurrentBuild -ge 22000) { if ($CurrentBuild -ge 22000) {
$Name = 'Win11' $Name = 'Win11'
} }
@@ -46,6 +47,9 @@ if ($SKU -notmatch "Srv") {
17763 { '2019' } 17763 { '2019' }
Default { $DisplayVersion } Default { $DisplayVersion }
} }
if ($InstallationType -eq "Server Core") {
$SKU += "_Core"
}
} }
#If Office is installed, modify the file name of the FFU #If Office is installed, modify the file name of the FFU