Browse Source

Update remove-default-apps.ps1

Move get-appxprovisionedpackage outside loop so that it only needs to be run once, instead of once for every app. Switch Where-Object clause to .Where() to improve performance.
pull/292/head
Benjamin Knickelbine 3 years ago
committed by GitHub
parent
commit
9c4d22a436
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      scripts/remove-default-apps.ps1

5
scripts/remove-default-apps.ps1

@ -132,13 +132,14 @@ $apps = @(
"Microsoft.Advertising.Xaml"
)
$appxprovisionedpackage = Get-AppxProvisionedPackage -Online
foreach ($app in $apps) {
Write-Output "Trying to remove $app"
Get-AppxPackage -Name $app -AllUsers | Remove-AppxPackage -AllUsers
Get-AppXProvisionedPackage -Online |
Where-Object DisplayName -EQ $app |
($appxprovisionedpackage).Where( {$_.DisplayName -EQ $app}) |
Remove-AppxProvisionedPackage -Online
}

Loading…
Cancel
Save