Update Invoke-WPFAppxRemoval.ps1

This commit is contained in:
Gabi
2026-06-21 09:16:33 -07:00
committed by GitHub
parent 91e72dde1b
commit 6b90c19ae5
+1 -17
View File
@@ -1,33 +1,17 @@
function Invoke-WPFAppxRemoval {
if ($sync.ProcessRunning) {
[System.Windows.MessageBox]::Show("A process is currently running.", "Winutil", "OK", "Warning")
return
}
$selected = @($sync.selectedAppx)
if (-not $selected) {
[System.Windows.MessageBox]::Show("Select AppX packages to remove.", "Winutil", "OK", "Warning")
return
}
$apps = $sync.configs.appxHashtable
Invoke-WPFRunspace -ParameterList @(("selected", $selected),("apps", $apps)) -ScriptBlock {
param($selected, $apps)
$sync.ProcessRunning = $true
foreach ($key in $selected) {
$package = $apps[$key].PackageId
Write-Host "Removing $package"
Get-AppxPackage -Name $package -AllUsers | Remove-AppxPackage -AllUsers
}
$sync.ProcessRunning = $false
Write-Host "================================="
Write-Host "-- AppX Removal Finished ---"
Write-Host "================================="
}
}
}