mirror of
https://github.com/rbalsleyMSFT/FFU.git
synced 2026-06-14 02:09:35 -06:00
Update BuildFFUVM.ps1
Adding "-PreventPending" to the "add-windowspackage" command allows the dism cleanup of the winsxs folder command to be moved from the InstallAppsandSysprep.cmd script to right after the updates are added to the vhdx. The end result: FFU image size before: 11.836GB FFU image size after: 11.190GB
This commit is contained in:
@@ -2240,10 +2240,13 @@ try {
|
|||||||
if ($UpdateLatestCU -or $UpdateLatestNet) {
|
if ($UpdateLatestCU -or $UpdateLatestNet) {
|
||||||
try {
|
try {
|
||||||
WriteLog "Adding KBs to $WindowsPartition"
|
WriteLog "Adding KBs to $WindowsPartition"
|
||||||
Add-WindowsPackage -Path $WindowsPartition -PackagePath $KBPath | Out-Null
|
Add-WindowsPackage -Path $WindowsPartition -PackagePath $KBPath -PreventPending | Out-Null
|
||||||
WriteLog "KBs added to $WindowsPartition"
|
WriteLog "KBs added to $WindowsPartition"
|
||||||
WriteLog "Removing $KBPath"
|
WriteLog "Removing $KBPath"
|
||||||
Remove-Item -Path $KBPath -Recurse -Force | Out-Null
|
Remove-Item -Path $KBPath -Recurse -Force | Out-Null
|
||||||
|
WriteLog "Clean Up the WinSxS Folder"
|
||||||
|
Dism /Image:$WindowsPartition /Cleanup-Image /StartComponentCleanup /ResetBase | Out-Null
|
||||||
|
WriteLog "Clean Up the WinSxS Folder completed"
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-Host "Adding KB to VHDX failed with error $_"
|
Write-Host "Adding KB to VHDX failed with error $_"
|
||||||
@@ -2498,4 +2501,4 @@ If ($CleanupAppsISO) {
|
|||||||
#Clean up dirty.txt file
|
#Clean up dirty.txt file
|
||||||
Remove-Item -Path .\dirty.txt -Force | out-null
|
Remove-Item -Path .\dirty.txt -Force | out-null
|
||||||
Write-Host "Script complete"
|
Write-Host "Script complete"
|
||||||
WriteLog "Script complete"
|
WriteLog "Script complete"
|
||||||
|
|||||||
Reference in New Issue
Block a user