mirror of
https://github.com/ChrisTitusTech/winutil
synced 2026-02-04 06:50:09 +00:00
Update-Remove-WinUtilAPPX.ps1 (#3822)
* Update Remove-WinUtilAPPX.ps1 * Modify Remove-WinUtilAPPX.ps1 to adjust package removal Removed '-AllUsers' parameter from Remove-AppxProvisionedPackage call. * Update Remove-WinUtilAPPX.ps1 * Fix formatting in Remove-WinUtilAPPX.ps1 * Update Remove-WinUtilAPPX.ps1
This commit is contained in:
@@ -15,19 +15,7 @@ function Remove-WinUtilAPPX {
|
|||||||
$Name
|
$Name
|
||||||
)
|
)
|
||||||
|
|
||||||
try {
|
Write-Host "Removing $Name"
|
||||||
Write-Host "Removing $Name"
|
Get-AppxPackage $Name -AllUsers | Remove-AppxPackage -AllUsers
|
||||||
Get-AppxPackage "*$Name*" | Remove-AppxPackage -ErrorAction SilentlyContinue
|
Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $Name | Remove-AppxProvisionedPackage -Online
|
||||||
Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like "*$Name*" | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue
|
|
||||||
} catch [System.Exception] {
|
|
||||||
if ($psitem.Exception.Message -like "*The requested operation requires elevation*") {
|
|
||||||
Write-Warning "Unable to uninstall $name due to a Security Exception"
|
|
||||||
} else {
|
|
||||||
Write-Warning "Unable to uninstall $name due to unhandled exception"
|
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
Write-Warning "Unable to uninstall $name due to unhandled exception"
|
|
||||||
Write-Warning $psitem.Exception.StackTrace
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user