Created
January 23, 2016 20:34
-
-
Save mintsoft/ce5281a637d90d938323 to your computer and use it in GitHub Desktop.
Windows 10 annoying embedded "apps" killer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#installed packages | |
Get-AppXPackage | Select Name | |
#automatically downloaded apps when clicked: | |
Get-AppXProvisionedPackage -Online | Select DisplayName | |
#Remove Package: | |
Get-AppXPackage Microsoft.Office.OneNote | remove-appxpackage | |
#Remove Provisioned Package: | |
Remove-AppXProvisionedPackage -Online -PackageName (Get-AppXProvisionedPackage -Online | ? { $_.DisplayName -like "Microsoft.Office.OneNote" }).PackageName | |
#For system packages that "can't be removed" : | |
$ProvisionedAppPackageNames = @( | |
"Microsoft.BingFinance" | |
"Microsoft.BingNews" | |
"Microsoft.BingSports" | |
"Microsoft.BingWeather" | |
"Microsoft.MicrosoftOfficeHub" | |
"Microsoft.Getstarted" | |
"microsoft.windowscommunicationsapps" #Mail, Calendar | |
"Microsoft.Office.OneNote" | |
"Microsoft.People" | |
"Microsoft.SkypeApp" | |
"Microsoft.XboxApp" | |
"Microsoft.ZuneMusic" | |
"Microsoft.ZuneVideo" | |
) | |
foreach ($ProvisionedAppName in $ProvisionedAppPackageNames) { | |
Get-AppxPackage -Name $ProvisionedAppName -AllUsers | Remove-AppxPackage | |
Get-AppXProvisionedPackage -Online | where DisplayName -EQ $ProvisionedAppName | Remove-AppxProvisionedPackage -Online | |
} | |
$RootPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\" | |
$SystemAppNames = @( "Windows-ContactSupport" ) | |
foreach ($SystemAppName in $SystemAppNames) { | |
$RegistryKeyApps = (ls "HKLM:\$RootPath" | where Name -Like "*$SystemAppName*") | |
foreach($RegistryKeyApp in $RegistryKeyApps) | |
{ | |
$RegistryKey = $RegistryKeyApp.Name.Substring(19) #Remove HKEY_LOCAL_MACHINE from string | |
Write-Host $RegistryKey | |
$key = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey($RegistryKey,[Microsoft.Win32.RegistryKeyPermissionCheck]::ReadWriteSubTree,[System.Security.AccessControl.RegistryRights]::ChangePermissions) | |
$acl = $key.GetAccessControl() | |
$rule = New-Object System.Security.AccessControl.RegistryAccessRule ("${[system.environment]::MachineName}\Administrator","FullControl","Allow") | |
$acl.SetAccessRule($rule) | |
$key.SetAccessControl($acl) | |
$subkey = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey("$RegistryKey\Owners",[Microsoft.Win32.RegistryKeyPermissionCheck]::ReadWriteSubTree,[System.Security.AccessControl.RegistryRights]::ChangePermissions) | |
$subacl = $subkey.GetAccessControl() | |
$subacl.SetAccessRule($rule) | |
$subkey.SetAccessControl($subacl) | |
Set-ItemProperty -Path "HKLM:\$RegistryKey" -Name Visibility -Value 1 | |
New-ItemProperty -Path "HKLM:\$RegistryKey" -Name DefVis -PropertyType DWord -Value 2 | |
Remove-Item -Path "HKLM:\$RegistryKey\Owners" | |
$AppName = $RegistryKey.Split('\')[-1] | |
DISM /Online /Remove-Package /PackageName:$AppName | |
} | |
#Remember to remove it from the currently logged in user (and rename "Windows-ContactSupport" to "Windows.ContactSupport") | |
Get-AppxPackage -Name $SystemAppName.Replace("-",".") -AllUsers | Remove-AppxPackage | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment