Skip to content

Commit

Permalink
close select 1 edition only
Browse files Browse the repository at this point in the history
  • Loading branch information
xrgzs committed Apr 30, 2024
1 parent e1ac5ce commit c58b11e
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions msupdate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -211,19 +211,19 @@ if ($?) {Write-Host "System Image Download Successfully!"} else {Write-Error "Sy
."C:\Program Files\7-Zip\7z.exe" x ".\temp\$osfile" -o".\ISO" -r

# select 1 edition only
if ($null -ne $SelectEdition) {
.\bin\wimlib-imagex.exe info ".\ISO\sources\install.wim" --extract-xml ".\temp\WIMInfo.xml"
$WIMInfo = [xml](Get-Content ".\temp\WIMInfo.xml")
$WIMIndex = $WIMInfo.WIM.IMAGE | Where-Object {$_.WINDOWS.EDITIONID -eq "$SelectEdition"} | Select-Object -ExpandProperty INDEX
$WIMIndexs = $WIMInfo.WIM.IMAGE.Index | Measure-Object | Select-Object -ExpandProperty Count
for ($i = $WIMIndexs; $i -gt $WIMIndex; $i--) {
# .\bin\wimlib-imagex.exe delete ".\ISO\sources\install.wim" $i --soft
Remove-WindowsImage -ImagePath ".\ISO\sources\install.wim" -Index $i
}
for ($i = 1; $i -lt $WIMIndex; $i++) {
Remove-WindowsImage -ImagePath ".\ISO\sources\install.wim" -Index 1
}
}
# if ($null -ne $SelectEdition) {
# .\bin\wimlib-imagex.exe info ".\ISO\sources\install.wim" --extract-xml ".\temp\WIMInfo.xml"
# $WIMInfo = [xml](Get-Content ".\temp\WIMInfo.xml")
# $WIMIndex = $WIMInfo.WIM.IMAGE | Where-Object {$_.WINDOWS.EDITIONID -eq "$SelectEdition"} | Select-Object -ExpandProperty INDEX
# $WIMIndexs = $WIMInfo.WIM.IMAGE.Index | Measure-Object | Select-Object -ExpandProperty Count
# for ($i = $WIMIndexs; $i -gt $WIMIndex; $i--) {
# # .\bin\wimlib-imagex.exe delete ".\ISO\sources\install.wim" $i --soft
# Remove-WindowsImage -ImagePath ".\ISO\sources\install.wim" -Index $i
# }
# for ($i = 1; $i -lt $WIMIndex; $i++) {
# Remove-WindowsImage -ImagePath ".\ISO\sources\install.wim" -Index 1
# }
# }

.\bin\wimlib-imagex.exe info ".\ISO\sources\install.wim" --extract-xml ".\temp\WIMInfo2.xml"
Get-Content ".\temp\WIMInfo2.xml"
Expand Down

0 comments on commit c58b11e

Please sign in to comment.