forked from adbertram/Random-PowerShell-Work
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds script that will remove pre-installed appx-packages both provisioned for new users and the ones already installed for existing users.
- Loading branch information
1 parent
1429296
commit c531cbb
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
Write-Progress -Activity "Remove Apps" -Status "Looking for apps to remove..." -PercentComplete 0 | ||
|
||
$PackagesToRemove = | ||
"Microsoft.3DBuilder", | ||
"Microsoft.Microsoft3DViewer", | ||
"Microsoft.BingFinance", | ||
"Microsoft.BingNews", | ||
"Microsoft.BingSports", | ||
"Microsoft.BingTranslator", | ||
"Microsoft.CommsPhone", | ||
"Microsoft.Getstarted", | ||
"Microsoft.Messaging", | ||
"Microsoft.MicrosoftOfficeHub", | ||
"Microsoft.MicrosoftSolitaireCollection", | ||
"Microsoft.Office.OneNote", | ||
"Microsoft.Office.Sway", | ||
"Microsoft.SkypeApp", | ||
"Microsoft.People", | ||
"Microsoft.WindowsAlarms", | ||
"Microsoft.WindowsCamera", | ||
"Microsoft.WindowsCommunicationsApps", | ||
"Microsoft.WindowsMaps", | ||
"Microsoft.WindowsPhone", | ||
"Microsoft.WindowsSoundRecorder", | ||
"Microsoft.XboxApp", | ||
"Microsoft.ZuneMusic", | ||
"Microsoft.ZuneVideo", | ||
"Microsoft.OneConnect", | ||
"Microsoft.WindowsFeedbackHub" | ||
|
||
$ProvisionPackagesToRemove = @() | ||
$AllUserPackagesToRemove = @() | ||
|
||
foreach($ProvisionedPackage in Get-AppxProvisionedPackage -Online) { | ||
foreach($PackageToRemove in $PackagesToRemove) { | ||
if($ProvisionedPackage.PackageName.Contains($PackageToRemove)) { | ||
$ProvisionPackagesToRemove += $ProvisionedPackage | ||
} | ||
} | ||
} | ||
|
||
foreach($AllUserPackage in Get-AppxPackage -AllUsers) { | ||
foreach($PackageToRemove in $PackagesToRemove) { | ||
if($AllUserPackage.PackageFullName.Contains($PackageToRemove)) { | ||
$AllUserPackagesToRemove += $AllUserPackage | ||
} | ||
} | ||
} | ||
|
||
$Total = $ProvisionPackagesToRemove.Count + $AllUserPackagesToRemove.Count | ||
$Progress = 0 | ||
|
||
foreach($ProvisionedPackage in $ProvisionPackagesToRemove) { | ||
Write-Progress -Activity "Remove Apps" -Status ("Removing Provisioned App: " + $ProvisionedPackage.PackageName + "...") -PercentComplete (($Progress++ / $Total) * 100) | ||
$ProvisionedPackage | Remove-AppxProvisionedPackage -Online | ||
} | ||
|
||
foreach($AllUserPackage in $AllUserPackagesToRemove) { | ||
Write-Progress -Activity "Remove Apps" -Status ("Removing AllUsers App: " + $AllUserPackage.Name + "...") -PercentComplete (($Progress++ / $Total) * 100) | ||
$AllUserPackage | Remove-AppxPackage -AllUsers | ||
} |