Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for Win10 2004 Features on Demand #254

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Operating System Deployment/Invoke-RemoveBuiltinApps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,23 @@
#>
Begin {
# White list of Features On Demand V2 packages
$WhiteListOnDemand = "NetFX3|Tools.Graphics.DirectX|Tools.DeveloperMode.Core|Language|Browser.InternetExplorer|ContactSupport|OneCoreUAP|Media.WindowsMediaPlayer|Hello.Face"
$WhiteListOnDemand = "NetFX3|Tools.Graphics.DirectX|Tools.DeveloperMode.Core|Language|Browser.InternetExplorer|ContactSupport|OneCoreUAP|Media.WindowsMediaPlayer|Hello.Face|Microsoft.Windows.Notepad|Microsoft.Windows.ISE|Microsoft.Windows.WordPad|Microsoft.Windows.MSPaint|Microsoft.Windows.PowerShell.ISE|App.StepsRecorder|Windows.Client.ShellComponents|DirectX.Configuration.Database"

# White list of appx packages to keep installed
$WhiteListedApps = New-Object -TypeName System.Collections.ArrayList
$WhiteListedApps.AddRange(@(
"Microsoft.DesktopAppInstaller",
"Microsoft.Office.OneNote",
"Microsoft.Messaging",
"Microsoft.Messaging",
"Microsoft.MSPaint",
"Microsoft.Windows.Photos",
"Microsoft.StorePurchaseApp",
"Microsoft.MicrosoftOfficeHub",
"Microsoft.MicrosoftStickyNotes",
"Microsoft.WindowsAlarms",
"Microsoft.WindowsCalculator",
"Microsoft.WindowsCalculator",
"Microsoft.WindowsCommunicationsApps", # Mail, Calendar etc
"Microsoft.WindowsSoundRecorder",
"Microsoft.WindowsSoundRecorder",
"Microsoft.WindowsStore"
))

Expand Down Expand Up @@ -103,7 +103,7 @@ Process {
$AppProvisioningPackageName = Get-AppxProvisionedPackage -Online | Where-Object { $_.DisplayName -like $App } | Select-Object -ExpandProperty PackageName -First 1

# Attempt to remove AppxPackage
if ($AppPackageFullName -ne $null) {
if ($null -ne $AppPackageFullName) {
try {
Write-LogEntry -Value "Removing AppxPackage: $($AppPackageFullName)"
Remove-AppxPackage -Package $AppPackageFullName -ErrorAction Stop | Out-Null
Expand All @@ -117,7 +117,7 @@ Process {
}

# Attempt to remove AppxProvisioningPackage
if ($AppProvisioningPackageName -ne $null) {
if ($null -ne $AppProvisioningPackageName) {
try {
Write-LogEntry -Value "Removing AppxProvisioningPackage: $($AppProvisioningPackageName)"
Remove-AppxProvisionedPackage -PackageName $AppProvisioningPackageName -Online -ErrorAction Stop | Out-Null
Expand Down Expand Up @@ -161,12 +161,12 @@ Process {
catch [System.Exception] {
Write-LogEntry -Value "Removing Feature on Demand V2 package failed: $($_.Exception.Message)"
}
}
}
}
catch [System.Exception] {
Write-LogEntry -Value "Attempting to list Feature on Demand V2 packages failed: $($_.Exception.Message)"
}

# Complete
Write-LogEntry -Value "Completed built-in AppxPackage, AppxProvisioningPackage and Feature on Demand V2 removal process"
}
}