mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-14 22:55:52 -06:00
[MicroWin] Add try-catch block for AppX packages (#2560)
This commit is contained in:
parent
b0d54e41ad
commit
4d2ea15e19
@ -132,6 +132,8 @@ function Remove-ProvisionedPackages() {
|
|||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Remove-ProvisionedPackages
|
Remove-ProvisionedPackages
|
||||||
#>
|
#>
|
||||||
|
try
|
||||||
|
{
|
||||||
$appxProvisionedPackages = Get-AppxProvisionedPackage -Path "$($scratchDir)" | Where-Object {
|
$appxProvisionedPackages = Get-AppxProvisionedPackage -Path "$($scratchDir)" | Where-Object {
|
||||||
$_.PackageName -NotLike "*AppInstaller*" -AND
|
$_.PackageName -NotLike "*AppInstaller*" -AND
|
||||||
$_.PackageName -NotLike "*Store*" -and
|
$_.PackageName -NotLike "*Store*" -and
|
||||||
@ -153,7 +155,6 @@ function Remove-ProvisionedPackages() {
|
|||||||
$_.PackageName -NotLike "*Gaming*" -and
|
$_.PackageName -NotLike "*Gaming*" -and
|
||||||
$_.PackageName -NotLike "*Extension*" -and
|
$_.PackageName -NotLike "*Extension*" -and
|
||||||
$_.PackageName -NotLike "*SecHealthUI*"
|
$_.PackageName -NotLike "*SecHealthUI*"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$counter = 0
|
$counter = 0
|
||||||
@ -169,6 +170,12 @@ function Remove-ProvisionedPackages() {
|
|||||||
}
|
}
|
||||||
Write-Progress -Activity "Removing Provisioned Apps" -Status "Ready" -Completed
|
Write-Progress -Activity "Removing Provisioned Apps" -Status "Ready" -Completed
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
# This can happen if getting AppX packages fails
|
||||||
|
Write-Host "Unable to get information about the AppX packages. MicroWin processing will continue, but AppX packages will not be processed"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function Copy-ToUSB([string]$fileToCopy) {
|
function Copy-ToUSB([string]$fileToCopy) {
|
||||||
foreach ($volume in Get-Volume) {
|
foreach ($volume in Get-Volume) {
|
||||||
|
Loading…
Reference in New Issue
Block a user