mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-08-10 01:51:18 +10:00
Update Invoke-WPFAppxRemoval.ps1
This commit is contained in:
@@ -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 "================================="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user