Files
management-scripts/Uninstall-UnwantedDefaultApps.ps1
2024-01-04 09:13:26 -05:00

107 lines
4.1 KiB
PowerShell

# Make sure this script runs as admin
#If ( IsAdmin -eq $false ) { Write-Output "This script can only be run as admin" ; Exit }
# This is the list of Windows 10 AppX app names that we'll try to uninstall
$AppList = @(
# Office Apps
'Microsoft.Office.Sway',
'Microsoft.MicrosoftOfficeHub',
'Microsoft.Office.Desktop',
'Microsoft.Getstarted',
'Microsoft.Microsoft3DViewer',
'Microsoft.SkypeApp',
'Microsoft.WindowsFeedbackHub',
# Windows Apps
'Microsoft.Getstarted',
'Microsoft.NetworkSpeedTest',
'Microsoft.FreshPaint',
'Microsoft.Print3D',
'Microsoft.SkypeApp',
'Microsoft.3DBuilder',
'Microsoft.Microsoft3DViewer',
'microsoft.windowscommunicationsapps',
'Microsoft.Advertising.Xaml',
'Microsoft.Advertising.Xaml',
'Microsoft.MicrosoftSolitaireCollection',
# 3rd Party Apps
'DB6EA5DB.MediaSuiteEssentialsforDell',
'DB6EA5DB.Power2GoforDell',
'DB6EA5DB.PowerDirectorforDell',
'DB6EA5DB.PowerMediaPlayerforDell',
'DellInc.DellDigitalDelivery',
'DellInc.DellSupportAssistforPCs',
'DellInc.PartnerPromo',
'HONHAIPRECISIONINDUSTRYCO.DellWatchdogTimer',
'AdobeSystemsIncorporated.AdobePhotoshopExpress',
'ActiproSoftwareLLC.562882FEEB491',
'D5EA27B7.Duolingo-LearnLanguagesforFree',
'Flipboard.Flipboard',
'king.com.CandyCrushSodaSaga',
'7EE7776C.LinkedInforWindows',
'9E2F88E3.Twitter',
'SlingTVLLC.SlingTV',
'Facebook.Facebook',
'A278AB0D.MarchofEmpires',
'Microsoft.MinecraftUWP',
'DB6EA5DB.CyberLinkMediaSuiteEssentials',
'PandoraMediaInc.29680B314EFC2'
)
# Remove/uninstall Appx packages on Windows 8 or higher
If ( IsWindowsBuild -ge 9200 )
{
ForEach ( $App in $AppList ) {
# Get the full name for the package and provisioned package
$PackageFullName = $($(Get-AppxPackage $App).PackageFullName)
$ProPackageFullName = $($(Get-AppxProvisionedPackage -Online | Where-Object {$_.Displayname -eq $App}).PackageName)
# Make sure we have a package
If ($PackageFullName) {
# Test if the package is an array
If ( $PackageFullName -is [System.Array] ) {
# Iterate through the array of packages and uninstall each one
ForEach ( $package in $PackageFullName ) {
Write-Output Removing package: ${package}
Try { Remove-AppxPackage -Package $package }
Catch { Write-Error $_.Exception.Message }
}
# If it's not an array, just uninstall the package
} Else {
Write-Output Removing package: ${PackageFullName}
Try { Remove-AppxPackage -Package $PackageFullName }
Catch { Write-Error $_.Exception.Message }
}
}
# Make sure we have a provisioned package
If ($ProPackageFullName) {
# Test if the provisioned package is an array
If ( $ProPackageFullName -is [System.Array] ) {
# Iterate through the array of provisioned packages and uninstall each one
ForEach ( $propackage in $ProPackageFullName ) {
Write-Output Removing provisioned package: ${propackage}
Try { Remove-AppxProvisionedPackage -PackageName $propackage -Online -AllUsers }
Catch { Write-Error $_.Exception.Message }
}
# If it's not an array, just uninstall the provisioned package
} Else {
Write-Output Removing provisioned package: ${ProPackageFullName}
Try { Remove-AppxProvisionedPackage -PackageName $ProPackageFullName -Online -AllUsers }
Catch { Write-Error $_.Exception.Message }
}
}
}
} Else { Write-Output "Cannot remove Appx packages because this endpoint is not running Windows 8 or higher" }
# Uninstall unwanted Dell apps
'Dell SupportAssist*', 'Dell Digital Delivery*', 'Dell Optimizer*', 'Dell Peripheral*', 'Dell Power Manager*', 'DellOptimizerUI*' | Uninstall-MSI