diff --git a/config/tweaks.json b/config/tweaks.json index 07c17d85..29729525 100644 --- a/config/tweaks.json +++ b/config/tweaks.json @@ -3091,8 +3091,8 @@ "panel": "1", "Order": "a002_", "InvokeScript": [ - "Get-ChildItem -Path \"C:\\Windows\\Temp\" *.* -Recurse | Remove-Item -Force -Recurse - Get-ChildItem -Path $env:TEMP *.* -Recurse | Remove-Item -Force -Recurse" + "Get-ChildItem -Path \"C:\\Windows\\Temp\" *.* -Recurse | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue + Get-ChildItem -Path $env:TEMP *.* -Recurse | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue" ], "link": "https://christitustech.github.io/winutil/dev/tweaks/Essential-Tweaks/DeleteTempFiles" }, diff --git a/functions/public/Invoke-WPFFeatureInstall.ps1 b/functions/public/Invoke-WPFFeatureInstall.ps1 index 02c37881..9ccf0ad0 100644 --- a/functions/public/Invoke-WPFFeatureInstall.ps1 +++ b/functions/public/Invoke-WPFFeatureInstall.ps1 @@ -18,12 +18,14 @@ function Invoke-WPFFeatureInstall { if ($FeatureConfig) { $Features = $FeatureConfig + $automation = $true } else { $Features = (Get-WinUtilCheckBoxes)["WPFFeature"] + $automation = $false } - Invoke-WPFRunspace -ArgumentList $Features -DebugPreference $DebugPreference -ScriptBlock { - param($Features, $DebugPreference) + Invoke-WPFRunspace -ArgumentList $Features, $automation -DebugPreference $DebugPreference -ScriptBlock { + param($Features, $automation, $DebugPreference) $sync.ProcessRunning = $true if ($Features.count -eq 1) { $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" }) diff --git a/functions/public/Invoke-WPFInstall.ps1 b/functions/public/Invoke-WPFInstall.ps1 index 120ab56b..1867a377 100644 --- a/functions/public/Invoke-WPFInstall.ps1 +++ b/functions/public/Invoke-WPFInstall.ps1 @@ -18,8 +18,10 @@ function Invoke-WPFInstall { if ($InstallConfig) { $PackagesToInstall = $InstallConfig + $automation = $true } else { $PackagesToInstall = (Get-WinUtilCheckBoxes)["Install"] + $automation = $false } if ($PackagesToInstall.Count -eq 0) { @@ -29,8 +31,8 @@ function Invoke-WPFInstall { } - Invoke-WPFRunspace -ArgumentList $PackagesToInstall -DebugPreference $DebugPreference -ScriptBlock { - param($PackagesToInstall, $DebugPreference) + Invoke-WPFRunspace -ArgumentList $PackagesToInstall, $automation -DebugPreference $DebugPreference -ScriptBlock { + param($PackagesToInstall, $automation, $DebugPreference) if ($PackagesToInstall.count -eq 1) { $sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" }) } else { diff --git a/functions/public/Invoke-WPFRunspace.ps1 b/functions/public/Invoke-WPFRunspace.ps1 index a462586c..dfba2931 100644 --- a/functions/public/Invoke-WPFRunspace.ps1 +++ b/functions/public/Invoke-WPFRunspace.ps1 @@ -22,10 +22,11 @@ function Invoke-WPFRunspace { Param ( $ScriptBlock, $ArgumentList, - $DebugPreference + $DebugPreference, + $automation ) - if ($PARAM_RUN) { + if ($automation = $true) { & $ScriptBlock @ArgumentList @DebugPreference } else { # Create a PowerShell instance diff --git a/functions/public/Invoke-WPFtweaksbutton.ps1 b/functions/public/Invoke-WPFtweaksbutton.ps1 index 342ec04b..5a19c31e 100644 --- a/functions/public/Invoke-WPFtweaksbutton.ps1 +++ b/functions/public/Invoke-WPFtweaksbutton.ps1 @@ -18,8 +18,10 @@ function Invoke-WPFtweaksbutton { if ($TweaksConfig) { $Tweaks = $TweaksConfig + $automation = $true } else { $Tweaks = (Get-WinUtilCheckBoxes)["WPFTweaks"] + $automation = $false } Set-WinUtilDNS -DNSProvider $sync["WPFchangedns"].text @@ -32,8 +34,8 @@ function Invoke-WPFtweaksbutton { Write-Debug "Number of tweaks to process: $($Tweaks.Count)" - Invoke-WPFRunspace -ArgumentList $Tweaks -DebugPreference $DebugPreference -ScriptBlock { - param($Tweaks, $DebugPreference) + Invoke-WPFRunspace -ArgumentList $Tweaks, $automation -DebugPreference $DebugPreference -ScriptBlock { + param($Tweaks, $automation, $DebugPreference) Write-Debug "Inside Number of tweaks to process: $($Tweaks.Count)" $sync.ProcessRunning = $true