diff --git a/functions/private/Remove-WinUtilAPPX.ps1 b/functions/private/Remove-WinUtilAPPX.ps1 index e90a101b..12c0ed42 100644 --- a/functions/private/Remove-WinUtilAPPX.ps1 +++ b/functions/private/Remove-WinUtilAPPX.ps1 @@ -15,19 +15,7 @@ function Remove-WinUtilAPPX { $Name ) - try { - Write-Host "Removing $Name" - Get-AppxPackage "*$Name*" | Remove-AppxPackage -ErrorAction SilentlyContinue - 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 - } + Write-Host "Removing $Name" + Get-AppxPackage $Name -AllUsers | Remove-AppxPackage -AllUsers + Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $Name | Remove-AppxProvisionedPackage -Online }