My Windows 10 Remove Apps Script

This Script will remove apps but leave Calculator and photos, Sticky Notes and Alarms. Must run as admin to remove provisioned apps. This can be run on an offline image, or an online one.

Edit: Updated 11/14/17 for Creator's Update
Edit2: updated 3/20/18 to add Microsoft.Xbox .TCUI


$applist = "Microsoft.Windows.CloudExperienceHost,
Microsoft.AAD.BrokerPlugin
Microsoft.AccountsControl
Microsoft.BioEnrollment
Microsoft.LockApp
Microsoft.MicrosoftEdge
Microsoft.Windows.AssignedAccessLockApp
Microsoft.Windows.ContentDeliveryManager
Microsoft.Windows.ParentalControls
Microsoft.Windows.ShellExperienceHost
Microsoft.XboxGameCallableUI
Microsoft.XboxIdentityProvider
Windows.ContactSupport
windows.immersivecontrolpanel
Windows.MiracastView
Windows.PrintDialog
Windows.PurchaseDialog
windows.devicesflow
Microsoft.Windows.Cortana
Microsoft.WindowsStore
Microsoft.Windows.FeatureOndemand.InsiderHub
Microsoft.WindowsCalculator
Microsoft.Windows.Photos
Microsoft.Windows.SecondaryTileExperience
Microsoft.WindowsFeedback
Microsoft.Windows.SecureAssessmentBrowser
Microsoft.Windows.Apprep.ChxApp
Microsoft.PPIProjection
Microsoft.MicrosoftStickyNotes
Microsoft.WindowsAlarms
Microsoft.WindowsMaps
Microsoft.WindowsCamera
Microsoft.DesktopAppInstaller
Microsoft.3DBuilder
Microsoft.MicrosoftSolitaireCollection
Microsoft.WindowsSoundRecorder
Microsoft.Xbox .TCUI  
"



if ($env:SYSTEMDRIVE -eq "X:")
{
$script:Offline = $true

# Find Windows
$drives = get-volume | ? { -not [String]::IsNullOrWhiteSpace($_.DriveLetter) } | ? { $_.DriveType -eq 'Fixed' } | ? { $_.DriveLetter -ne 'X' }
$drives | ? { Test-Path "$($_.DriveLetter):\Windows\System32" } | % { $script:OfflinePath = "$($_.DriveLetter):\" }
Write-Verbose "Eligible offline drive found: $script:OfflinePath"
Get-AppxProvisionedPackage -Path $script:OfflinePath | ?{ $applist -notmatch $_.displayname } | ?{ Remove-AppxProvisionedPackage -Path $script:OfflinePath -PackageName $_.PackageName }
Get-AppxPackage | ?{ $_.isFramework -eq $false } | ?{ $applist -notmatch $_.name } | Remove-AppxPackage
}
else
{
Write-Verbose "Running in the full OS."
$script:Offline = $false
Get-AppxProvisionedPackage -Online  | ?{ $applist -notmatch $_.displayname } | ?{ Remove-AppxProvisionedPackage -Online -PackageName $_.PackageName }
Get-AppxPackage | ?{ $_.isFramework -eq $false } | ?{ $applist -notmatch $_.name } | Remove-AppxPackage
}

Comments

Popular posts from this blog

SCCM PXE Boot Issues - No Advertisements Found

SCCM PXE Boot Issues - UEFI and Secure Boot

Application Doesn't Install During OSD Task Sequence in SCCM