Forum Discussion
JimmyWork
Sep 29, 2022Iron Contributor
Remediation script says it worked but did not actually remove applications
The following works when you run it local on the computer. It also works if it is package as a win32 app and ran at deployment during Autopilot. It however does not work as a remediation script....
- Sep 30, 2022Adding -AllUsers to both Get and Remove-AppxPackage fixed the issue
PhilSheppard
Oct 05, 2022Copper Contributor
JimmyWork Can you please post full version of the scripts, including "-AllUsers"?
JimmyWork
Oct 05, 2022Iron Contributor
This is the current version, not finished with detect script. This is my co-workers code not mine so I don't take any credit here.
#Uninstalls built-in applications not needed for organisation devices
# List of Applications to Remove
$AppPackages = @()
$AppPackages += 'Microsoft.Xbox.TCUI'
$AppPackages += 'Microsoft.XboxApp'
$AppPackages += 'Microsoft.XboxGamingOverlay'
$AppPackages += 'Microsoft.XboxIdentityProvider'
$AppPackages += 'Microsoft.XboxSpeechToTextOverlay'
$AppPackages += 'Microsoft.GamingApp'
$AppPackages += 'Microsoft.SkypeApp'
$AppPackages += 'MicrosoftTeams'
$AppPackages += 'Microsoft.ZuneMusic'
$AppPackages += 'Microsoft.ZuneVideo'
$AppPackages += 'Microsoft.WindowsFeedbackHub'
$AppPackages += 'Microsoft.549981C3F5F10'
$AppPackages += 'Microsoft.BingNews'
$AppPackages += 'Microsoft.BingWeather'
$AppPackages += 'Microsoft.MicrosoftSolitaireCollection'
$AppPackages += 'Microsoft.WindowsMaps'
$AppPackages += 'Microsoft.GetStarted'
$AppPackages += 'Microsoft.People'
$AppPackages += 'Microsoft.windowscommunicationsapps'
$AppPackages += 'Microsoft.Messaging'
$AppPackages += 'Microsoft.MixedReality.Portal'
$AppPackages += 'Microsoft.YourPhone'
$AppPackages += 'Microsoft.OneConnect'
$Error.Clear()
foreach ($App In $AppPackages)
{
try {
Write-Host "+ Removing AppX Package: $App"
Get-AppxPackage AllUsers -PackageTypeFilter Main,Bundle,Resource,Framework | Where-Object {$_.Name -eq $App } | Remove-AppxPackage -AllUsers
Write-Host "+ Removing Provisioned Package: $App"
Get-AppxProvisionedPackage -Online | Where-Object {$_.DisplayName -eq $App} | Remove-AppxProvisionedPackage -Online -AllUsers
Write-Host ""
}
catch {
Write-Host "** ERROR ** Failed to remove: $App **"
Write-Host "ERROR: at $($_.InvocationInfo.ScriptLineNumber)"
Write-Error "Message: " $_.Exception.Message
Write-Host "StackTrace: "
Write-Host $_.Exception.StackTrace
Write-Host ""
exit 1
}
}
exit 0