For those not using LTSB but still want to remove all those builtin apps that come with Windows 10, the following script is what you need!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# Functions function Write-LogEntry { param( [parameter(Mandatory=$true, HelpMessage="Value added to the RemovedApps.log file.")] [ValidateNotNullOrEmpty()] [string]$Value, [parameter(Mandatory=$false, HelpMessage="Name of the log file that the entry will written to.")] [ValidateNotNullOrEmpty()] [string]$FileName = "RemovedApps.log" ) # Determine log file location $LogFilePath = Join-Path -Path $env:windir -ChildPath "Temp\$($FileName)" # Add value to log file try { Add-Content -Value $Value -LiteralPath $LogFilePath -ErrorAction Stop } catch [System.Exception] { Write-Warning -Message "Unable to append log entry to RemovedApps.log file" } } # Get a list of all apps Write-LogEntry -Value "Starting appx package removal" $AppArrayList = Get-AppxPackage -PackageTypeFilter Bundle -AllUsers | Select-Object -Property Name, PackageFullName | Sort-Object -Property Name # White list of appx packages to keep installed $WhiteListedApps = @( "Microsoft.DesktopAppInstaller", "Microsoft.StorePurchaseApp" "Microsoft.WindowsCalculator", "Microsoft.WindowsStore", "Microsoft.XboxApp", "Microsoft.Windows.Photos", "Microsoft.StorePurchaseApp", "Windows.PrintDialog", "Microsoft.XboxIdentityProvider", "Microsoft.Windows.ContentDeliveryManager", "windows.immersivecontrolpanel", "Microsoft.MicrosoftEdge", "Microsoft.MSPaint", "Microsoft.Windows.SecHealthUI", "Microsoft.WindowsCamera", "Microsoft.Wallet", "Microsoft.XboxGameOverlay", "Microsoft.XboxSpeechToTextOverlay", "Microsoft.XboxGameCallableui", "Microsoft.WindowsFeedbackHub" ) # Loop through the list of appx packages foreach ($App in $AppArrayList) { # If application name not in appx package white list, remove AppxPackage and AppxProvisioningPackage if (($App.Name -in $WhiteListedApps)) { Write-LogEntry -Value "Skipping excluded application package: $($App.Name)" } else { # Gather package names $AppPackageFullName = Get-AppxPackage -Name $App.Name | Select-Object -ExpandProperty PackageFullName $AppProvisioningPackageName = Get-AppxProvisionedPackage -Online | Where-Object { $_.DisplayName -like $App.Name } | Select-Object -ExpandProperty PackageName # Attempt to remove AppxPackage try { Write-LogEntry -Value "Removing application package: $($AppPackageFullName)" Remove-AppxPackage -Package $AppPackageFullName -ErrorAction Stop } catch [System.Exception] { Write-Warning -Message $_.Exception.Message } # Attempt to remove AppxProvisioningPackage if ($AppProvisioningPackageName -ne $null) { try { Write-LogEntry -Value "Removing application provisioning package: $($AppProvisioningPackageName)" Remove-AppxProvisionedPackage -PackageName $AppProvisioningPackageName -Online -ErrorAction Stop } catch [System.Exception] { Write-Warning -Message $_.Exception.Message } } } } # White list of Features On Demand V2 packages Write-LogEntry -Value "Starting Features on Demand V2 removal" $WhiteListOnDemand = "NetFX3|Tools.Graphics.DirectX|Tools.DeveloperMode.Core|Language|Browser.InternetExplorer|Media.WindowsMediaPlayer" # Get Features On Demand that should be removed $OnDemandFeatures = Get-WindowsCapability -Online | Where-Object { $_.Name -notmatch $WhiteListOnDemand -and $_.State -like "Installed"} | Select-Object -ExpandProperty Name foreach ($Feature in $OnDemandFeatures) { try { Write-LogEntry -Value "Removing feature on demand: $($Feature)" Get-WindowsCapability -Online -ErrorAction Stop | Where-Object { $_.Name -like $Feature } | Remove-WindowsCapability -Online -ErrorAction Stop } catch [System.Exception] { Write-Warning -Message $_.Exception.Message } } |
This will blanket remove all apps unless in the $WhiteListedApps array.
To get a list of the apps you need to run:
1 |
Get-AppxPackage -PackageTypeFilter Bundle -AllUsers | Select-Object -Property Name, PackageFullName | Sort-Object -Property Name |
Copy the value in the “Name” Column into the $WhiteListedApps array to ensure its not removed. Some apps may be dependant on other apps, so make sure you test thoroughly!
Once you are happy, save it to a sub-folder where you keep your Source files and create a new ConfigMgr package without a a program. Once created, edit it and under the Data Souece tab enter the path to the folder you created above. Deploy it to your DPs.
Now edit your task sequence and create a new powershell step as shown here
And there you go! If you’ve done it right, then only the whitelisted apps will be installed on the target machine.
This is exactly what I need thanks for this. Looking at your task sequence. Can I ask how you hide the people application?
If I recall correctly, it was part of the People app, so this should be removed automatically if the People app is removed, if not then there is a registry key you can edit
https://winaero.com/blog/remove-people-icon-windows-10/
Cheers I’ll have a look. Would you be able to share with me the default user registry step so I can have a look at what steps you do? I understand I might be pushing my luck!
Yeah its not a problem – its a simple “Run Command Line” with the following command:
cmd.exe /c reg.exe load HKU\DU C:\users\default\ntuser.dat
Then, for each step you do “reg add “HKU\DU\ ” to inject settings you want and they’ll be apply to all users.
Finally, close the key:
cmd.exe /c reg.exe unload HKU\DU
I’ll try and do a proper write up later on.
Cheers, thats great. What are the reg settings for people?
cmd /c reg add HKU\DU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People /v “PeopleBand” /t REG_DWORD /d “0” /f
Just need to place the step between your reg key load/unload steps