Поделиться через


Windows 10: Removing Groove, Facebook, and Other Unwanted Apps

A few months ago, someone very dear to me asked why they couldn't remove unwanted apps from Windows 10 - mainly over privacy and right to decline concerns. I took it up as a sort of personal challenge to find a way to rid these apps for other people, as well, whilst I was attempting to figure out how to do this for them specifically. So, I give you the result - which is still a work in progress.

function Remove-UnwantedApps { # Attempt to remove Facebook (if it exists) $facebookPkg = Get-AppxPackage -AllUsers | Where{$_.Name -like '*Facebook*'} if($facebookPkg -ne $null) { Remove-AppxPackage $facebookPkg.PackageFullName -Confirm:$FALSE } # Attempt to remove Groove Music $grooveMusicPkg = Get-AppxPackage -AllUsers | Where{$_.PackageFullName -ilike '*ZuneMusic*'} if($grooveMusicPkg -ne $null) { Remove-AppxPackage $grooveMusicPkg.PackageFullName -Confirm:$FALSE } # Attempt to remove Groove Video $grooveVideoPkg = Get-AppxPackage -AllUsers | Where{$_.Name -like '*ZuneVideo*'} if($grooveVideoPkg -ne $null) { Remove-AppxPackage $grooveVideoPkg.PackageFullName -Confirm:$FALSE } # Attempt to remove all things XBox. $xboxPkgs = Get-AppxPackage -AllUsers | Where{$_.Name -like '*Xbox*'} foreach($xboxPkg in $xboxPkgs) { Remove-AppxPackage $xboxPkg.PackageFullName -Confirm:$FALSE } # Attempt to remove the Advertising apps $advertPkgs = Get-AppxPackage -AllUsers | Where{$_.Name -like '*Microsoft.Advertising*'} foreach($advertPkg in $advertPkgs) { Remove-AppxPackage $advertPkg.PackageFullName -Confirm:$FALSE } # Attempt to remove the Bing apps $bingPkgs = Get-AppxPackage -AllUsers | Where{$_.Name -like '*Microsoft.Bing*'} foreach($bingPkg in $bingPkgs) { Remove-AppxPackage $bingPkg.PackageFullName -Confirm:$FALSE } # Attempt to remove the Messaging package $msgPkg = Get-AppxPackage -AllUsers | Where{$_.Name -like '*Microsoft.Messaging*'} Remove-AppxPackage $msgPkg.PackageFullName -Confirm:$FALSE # Attempt to remove Windows Store dependent packages $storeDepPkgs = Get-AppxPackage -AllUsers | Where{$_.Dependencies -ilike '*Store*' -and $_.Name -inotlike '*WindowsStore*'} foreach($sdPkg in $storeDepPkgs) { Remove-AppxPackage $sdPkg.PackageFullName -Confirm:$FALSE } # Attempt to remove Windows Store package $storePkg = Get-AppxPackage -AllUsers | Where{$_.Name -ilike '*WindowsStore*'} if($storePkg -ne $null) { Remove-AppxPackage $storePkg.PackageFullName -Confirm:$FALSE } # Attempt to disable Cortana via the Registry $searchRegistyPath = Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" if($searchRegistyPath -eq $FALSE) { # Create the Windows Search Registry Key New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows" -Name "Windows Search" # Create the AllowCortana Registry Key New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "AllowCortana" # Disable Cortana via the path Set-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search\AllowCortana" -Value 0 } else { # Let's ensure the child item exists. $allowCortanaRegistryPath = Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search\AllowCortana" if($allowCortanaRegistryPath -eq $FALSE) { # Create the AllowCortana Registry Key New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "AllowCortana" } # Disable Cortana via the path Set-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search\AllowCortana" -Value 0 } # Stop the Windows Search Service $searchService = Get-Service WSearch Stop-Service -InputObject $searchService -Force # Attempt to remove Cortana via the App Package $cortanaPkg = Get-AppxPackage -AllUsers | Where{$_.PackageFullName -ilike '*Cort*'} foreach($cPkg in $cortanaPkg) { Remove-AppxPackage $cPkg.PackageFullName -Confirm:$FALSE } # Restart the system, so the registy changes take effect in the Windows Search Service's OnStart() method body. }

Please note that this has only been tested on a local machine and, so far, validates. This can produce undesired results, such as not being able to install packages from the Windows Store in the future, since the Windows Store is removed via this script. YOU HAVE BEEN WARNED.

To use: Copy the red text into an Administrative session in PowerShell (right-click the PowerShell icon --> Run as Administrator). Run 'Remove-UnwantedApps' at the new line, after the red code lines from above have been pasted into the PowerShell session. Restart your machine. Profit.