diff --git a/FFUDevelopment/BuildFFUVM.ps1 b/FFUDevelopment/BuildFFUVM.ps1 index 864747a..dc7d828 100644 --- a/FFUDevelopment/BuildFFUVM.ps1 +++ b/FFUDevelopment/BuildFFUVM.ps1 @@ -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"