mirror of
https://github.com/rbalsleyMSFT/FFU.git
synced 2026-06-14 02:09:35 -06:00
Refactor BuildFFUVM.ps1 script***
This commit refactors the BuildFFUVM.ps1 script by: - Changing the default value of FFUDevelopmentPath to $PSScriptRoot - Adding a new parameter RemoveFFU - Adding a new function Remove-FFU to remove all FFU files in the FFUCaptureLocation - Adding a conditional block to call Remove-FFU if RemoveFFU parameter is true
This commit is contained in:
@@ -125,7 +125,7 @@ param(
|
||||
})]
|
||||
[string]$WindowsSKU = 'Pro',
|
||||
[ValidateScript({ Test-Path $_ })]
|
||||
[string]$FFUDevelopmentPath = 'C:\FFUDevelopment',
|
||||
[string]$FFUDevelopmentPath = $PSScriptRoot,
|
||||
[bool]$InstallApps,
|
||||
[bool]$InstallOffice,
|
||||
[Parameter(Mandatory = $false)]
|
||||
@@ -210,10 +210,11 @@ param(
|
||||
return $true
|
||||
})]
|
||||
[bool]$CopyDrivers,
|
||||
[bool]$RemoveFFU,
|
||||
#Will be used in future release
|
||||
[bool]$CopyPPKG,
|
||||
[bool]$CopyUnattend,
|
||||
[bool]$RemoveFFU
|
||||
[bool]$CopyUnattend
|
||||
|
||||
)
|
||||
$version = '2402.1'
|
||||
|
||||
@@ -1392,6 +1393,12 @@ function Get-FFUEnvironment {
|
||||
Remove-Item -Path "$FFUDevelopmentPath\dirty.txt" -Force
|
||||
WriteLog "Cleanup complete"
|
||||
}
|
||||
function Remove-FFU{
|
||||
#Remove all FFU files in the FFUCaptureLocation
|
||||
WriteLog "Removing all FFU files in $FFUCaptureLocation"
|
||||
Remove-Item -Path $FFUCaptureLocation\*.ffu -Force
|
||||
WriteLog "Removal complete"
|
||||
}
|
||||
|
||||
###END FUNCTIONS
|
||||
|
||||
@@ -1706,6 +1713,17 @@ If ($BuildUSBDrive) {
|
||||
throw $_
|
||||
}
|
||||
}
|
||||
If ($RemoveFFU){
|
||||
try {
|
||||
Remove-FFU
|
||||
}
|
||||
catch {
|
||||
Write-Host 'Removing FFU files failed'
|
||||
Writelog "Removing FFU files failed with error $_"
|
||||
throw $_
|
||||
}
|
||||
|
||||
}
|
||||
#Clean up dirty.txt file
|
||||
Remove-Item -Path .\dirty.txt -Force | out-null
|
||||
Write-Host "Script complete"
|
||||
|
||||
Reference in New Issue
Block a user