2017-12-12 01:37:16 +00:00
#This function finds any AppX/AppXProvisioned package and uninstalls it, except for Freshpaint, Windows Calculator, Windows Store, and Windows Photos.
#Also, to note - This does NOT remove essential system services/software/etc such as .NET framework installations, Cortana, Edge, etc.
2018-06-15 01:22:01 +00:00
#no errors throughout
$ErrorActionPreference = 'silentlycontinue'
2017-12-12 04:23:24 +00:00
If ( Test-Path " C:\Windows10Debloater " ) {
Write-Output " C:\Windows10Debloater exists. Skipping. "
}
Else {
Write-Output " The folder 'C:\Windows10Debloater' doesn't exist. This folder will be used for storing logs created after the script runs. Creating now. "
2018-03-07 04:31:11 +00:00
Start-Sleep 1
2017-12-12 04:23:24 +00:00
New-Item -Path " C:\Windows10Debloater " -ItemType Directory
2018-10-05 02:42:20 +00:00
Write-Output " The folder C:\Windows10Debloater was successfully created. "
2017-12-12 04:23:24 +00:00
}
Start-Transcript -OutputDirectory " C:\Windows10Debloater "
2018-06-03 14:20:16 +00:00
2018-10-05 02:42:20 +00:00
Add-Type -AssemblyName PresentationCore , PresentationFramework
2018-07-17 01:43:31 +00:00
2018-10-05 04:04:40 +00:00
Function DebloatAll {
2017-12-12 01:37:16 +00:00
[ CmdletBinding ( ) ]
Param ( )
#Removes AppxPackages
2018-02-19 15:59:58 +00:00
#Credit to /u/GavinEke for a modified version of my whitelist code
2018-10-10 00:53:51 +00:00
[ regex ] $WhitelistedApps = 'Microsoft.ScreenSketch|Microsoft.Paint3D|Microsoft.WindowsCalculator|Microsoft.WindowsStore|Microsoft.Windows.Photos|CanonicalGroupLimited.UbuntuonWindows|Microsoft.XboxGameCallableUI|Microsoft.XboxGamingOverlay|Microsoft.Xbox.TCUI|Microsoft.XboxGamingOverlay|Microsoft.XboxIdentityProvider|Microsoft.MicrosoftStickyNotes|Microsoft.MSPaint'
2018-06-03 14:20:16 +00:00
Get-AppxPackage -AllUsers | Where-Object { $_ . Name -NotMatch $WhitelistedApps } | Remove-AppxPackage
2018-06-11 16:36:42 +00:00
Get-AppxPackage | Where-Object { $_ . Name -NotMatch $WhitelistedApps } | Remove-AppxPackage
2018-06-03 14:20:16 +00:00
Get-AppxProvisionedPackage -Online | Where-Object { $_ . PackageName -NotMatch $WhitelistedApps } | Remove-AppxProvisionedPackage -Online
2017-12-12 01:37:16 +00:00
}
2018-06-04 13:43:23 +00:00
2018-10-05 02:42:20 +00:00
Function DebloatBlacklist {
[ CmdletBinding ( ) ]
Param ( )
$Bloatware = @ (
#Unnecessary Windows 10 AppX Apps
" Microsoft.BingNews "
" Microsoft.DesktopAppInstaller "
" Microsoft.GetHelp "
" Microsoft.Getstarted "
" Microsoft.Messaging "
" Microsoft.Microsoft3DViewer "
" Microsoft.MicrosoftOfficeHub "
" Microsoft.MicrosoftSolitaireCollection "
" Microsoft.NetworkSpeedTest "
" Microsoft.Office.OneNote "
" Microsoft.Office.Sway "
" Microsoft.OneConnect "
" Microsoft.People "
" Microsoft.Print3D "
" Microsoft.RemoteDesktop "
" Microsoft.SkypeApp "
" Microsoft.StorePurchaseApp "
" Microsoft.WindowsAlarms "
" Microsoft.WindowsCamera "
" microsoft.windowscommunicationsapps "
" Microsoft.WindowsFeedbackHub "
" Microsoft.WindowsMaps "
" Microsoft.WindowsSoundRecorder "
" Microsoft.Xbox.TCUI "
" Microsoft.XboxApp "
" Microsoft.XboxGameOverlay "
" Microsoft.XboxIdentityProvider "
" Microsoft.XboxSpeechToTextOverlay "
" Microsoft.ZuneMusic "
" Microsoft.ZuneVideo "
#Sponsored Windows 10 AppX Apps
#Add sponsored/featured apps to remove in the "*AppName*" format
" *EclipseManager* "
" *ActiproSoftwareLLC* "
" *AdobeSystemsIncorporated.AdobePhotoshopExpress* "
" *Duolingo-LearnLanguagesforFree* "
" *PandoraMediaInc* "
" *CandyCrush* "
" *Wunderlist* "
" *Flipboard* "
" *Twitter* "
" *Facebook* "
" *Spotify* "
" *Minecraft* "
" *Royal Revolt* "
#Optional: Typically not removed but you can if you need to for some reason
#"*Microsoft.Advertising.Xaml_10.1712.5.0_x64__8wekyb3d8bbwe*"
#"*Microsoft.Advertising.Xaml_10.1712.5.0_x86__8wekyb3d8bbwe*"
#"*Microsoft.BingWeather*"
#"*Microsoft.MSPaint*"
#"*Microsoft.MicrosoftStickyNotes*"
#"*Microsoft.Windows.Photos*"
#"*Microsoft.WindowsCalculator*"
#"*Microsoft.WindowsStore*"
)
foreach ( $Bloat in $Bloatware ) {
Get-AppxPackage -Name $App | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $App | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue
Write-Output " Trying to remove $Bloat . "
}
}
2017-12-12 01:37:16 +00:00
Function Remove-Keys {
[ CmdletBinding ( ) ]
Param ( )
#These are the registry keys that it will delete.
$Keys = @ (
#Remove Background Tasks
" HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y "
" HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0 "
" HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe "
" HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy "
" HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy "
" HKCR:\Extensions\ContractId\Windows.BackgroundTasks\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy "
#Windows File
" HKCR:\Extensions\ContractId\Windows.File\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0 "
#Registry keys to delete if they aren't uninstalled by RemoveAppXPackage/RemoveAppXProvisionedPackage
" HKCR:\Extensions\ContractId\Windows.Launch\PackageId\46928bounde.EclipseManager_2.2.4.51_neutral__a5h4egax66k6y "
" HKCR:\Extensions\ContractId\Windows.Launch\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0 "
" HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy "
" HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy "
" HKCR:\Extensions\ContractId\Windows.Launch\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy "
#Scheduled Tasks to delete
" HKCR:\Extensions\ContractId\Windows.PreInstalledConfigTask\PackageId\Microsoft.MicrosoftOfficeHub_17.7909.7600.0_x64__8wekyb3d8bbwe "
#Windows Protocol Keys
" HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0 "
" HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy "
" HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy "
" HKCR:\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.XboxGameCallableUI_1000.16299.15.0_neutral_neutral_cw5n1h2txyewy "
#Windows Share Target
" HKCR:\Extensions\ContractId\Windows.ShareTarget\PackageId\ActiproSoftwareLLC.562882FEEB491_2.6.18.18_neutral__24pqs290vpjk0 "
)
#This writes the output of each key it is removing and also removes the keys listed above.
ForEach ( $Key in $Keys ) {
Write-Output " Removing $Key from registry "
2018-06-03 14:20:16 +00:00
Remove-Item $Key -Recurse
2017-12-12 01:37:16 +00:00
}
}
Function Protect-Privacy {
[ CmdletBinding ( ) ]
Param ( )
#Disables Windows Feedback Experience
Write-Output " Disabling Windows Feedback Experience program "
2018-06-05 02:06:38 +00:00
$Advertising = " HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo "
2017-12-12 01:37:16 +00:00
If ( Test-Path $Advertising ) {
2018-06-15 01:21:19 +00:00
Set-ItemProperty $Advertising Enabled -Value 0
2017-12-12 01:37:16 +00:00
}
#Stops Cortana from being used as part of your Windows Search Function
Write-Output " Stopping Cortana from being used as part of your Windows Search Function "
2018-06-05 02:06:38 +00:00
$Search = " HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search "
2017-12-12 01:37:16 +00:00
If ( Test-Path $Search ) {
2018-06-15 01:21:19 +00:00
Set-ItemProperty $Search AllowCortana -Value 0
2017-12-12 01:37:16 +00:00
}
2018-06-05 02:06:38 +00:00
#Disables Web Search in Start Menu
Write-Output " Disabling Bing Search in Start Menu "
$WebSearch = " HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search "
2018-06-15 01:21:19 +00:00
Set-ItemProperty " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search " BingSearchEnabled -Value 0
2018-10-05 02:42:20 +00:00
If ( ! ( Test-Path $WebSearch ) ) {
2018-06-05 02:06:38 +00:00
New-Item $WebSearch
2018-10-05 02:42:20 +00:00
}
Set-ItemProperty $WebSearch DisableWebSearch -Value 1
2017-12-12 01:37:16 +00:00
#Stops the Windows Feedback Experience from sending anonymous data
Write-Output " Stopping the Windows Feedback Experience program "
2018-06-05 02:06:38 +00:00
$Period = " HKCU:\Software\Microsoft\Siuf\Rules "
If ( ! ( Test-Path $Period ) ) {
New-Item $Period
}
2018-06-15 01:21:19 +00:00
Set-ItemProperty $Period PeriodInNanoSeconds -Value 0
2018-06-05 02:06:38 +00:00
#Prevents bloatware applications from returning and removes Start Menu suggestions
2017-12-12 01:37:16 +00:00
Write-Output " Adding Registry key to prevent bloatware apps from returning "
$registryPath = " HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent "
2018-06-04 13:43:23 +00:00
$registryOEM = " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager "
2018-06-05 02:06:38 +00:00
If ( ! ( Test-Path $registryPath ) ) {
New-Item $registryPath
2018-06-04 13:43:23 +00:00
}
2018-06-15 01:21:19 +00:00
Set-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 1
2018-06-05 02:06:38 +00:00
2018-06-04 13:43:23 +00:00
If ( ! ( Test-Path $registryOEM ) ) {
2018-06-05 02:06:38 +00:00
New-Item $registryOEM
}
2018-10-05 02:42:20 +00:00
Set-ItemProperty $registryOEM ContentDeliveryAllowed -Value 0
Set-ItemProperty $registryOEM OemPreInstalledAppsEnabled -Value 0
Set-ItemProperty $registryOEM PreInstalledAppsEnabled -Value 0
Set-ItemProperty $registryOEM PreInstalledAppsEverEnabled -Value 0
Set-ItemProperty $registryOEM SilentInstalledAppsEnabled -Value 0
Set-ItemProperty $registryOEM SystemPaneSuggestionsEnabled -Value 0
2018-06-05 02:06:38 +00:00
#Preping mixed Reality Portal for removal
2017-12-12 01:37:16 +00:00
Write-Output " Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings "
2018-06-05 02:06:38 +00:00
$Holo = " HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic "
2017-12-12 01:37:16 +00:00
If ( Test-Path $Holo ) {
2018-06-15 01:21:19 +00:00
Set-ItemProperty $Holo FirstRunSucceeded -Value 0
2018-06-05 02:06:38 +00:00
}
#Disables Wi-fi Sense
Write-Output " Disabling Wi-Fi Sense "
$WifiSense1 = " HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting "
$WifiSense2 = " HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots "
$WifiSense3 = " HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\config "
If ( ! ( Test-Path $WifiSense1 ) ) {
2018-10-05 02:42:20 +00:00
New-Item $WifiSense1
2017-12-12 01:37:16 +00:00
}
2018-06-15 01:21:19 +00:00
Set-ItemProperty $WifiSense1 Value -Value 0
2018-10-05 02:42:20 +00:00
If ( ! ( Test-Path $WifiSense2 ) ) {
New-Item $WifiSense2
2018-06-05 02:06:38 +00:00
}
2018-06-15 01:21:19 +00:00
Set-ItemProperty $WifiSense2 Value -Value 0
2018-10-05 02:42:20 +00:00
Set-ItemProperty $WifiSense3 AutoConnectAllowedOEM -Value 0
2017-12-12 01:37:16 +00:00
#Disables live tiles
Write-Output " Disabling live tiles "
2018-06-05 02:06:38 +00:00
$Live = " HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications "
If ( ! ( Test-Path $Live ) ) {
New-Item $Live
2017-12-12 01:37:16 +00:00
}
2018-06-15 01:21:19 +00:00
Set-ItemProperty $Live NoTileApplicationNotification -Value 1
2017-12-12 01:37:16 +00:00
#Turns off Data Collection via the AllowTelemtry key by changing it to 0
Write-Output " Turning off Data Collection "
2018-06-05 02:06:38 +00:00
$DataCollection1 = " HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection "
$DataCollection2 = " HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection "
$DataCollection3 = " HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection "
If ( Test-Path $DataCollection1 ) {
2018-06-15 01:21:19 +00:00
Set-ItemProperty $DataCollection1 AllowTelemetry -Value 0
2018-06-05 02:06:38 +00:00
}
If ( Test-Path $DataCollection2 ) {
2018-06-15 01:21:19 +00:00
Set-ItemProperty $DataCollection2 AllowTelemetry -Value 0
2017-12-12 01:37:16 +00:00
}
2018-06-05 02:06:38 +00:00
If ( Test-Path $DataCollection3 ) {
2018-06-15 01:21:19 +00:00
Set-ItemProperty $DataCollection3 AllowTelemetry -Value 0
2018-06-05 02:06:38 +00:00
}
#Disabling Location Tracking
Write-Output " Disabling Location Tracking "
$SensorState = " HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44} "
$LocationConfig = " HKLM:\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration "
If ( ! ( Test-Path $SensorState ) ) {
New-Item $SensorState
}
2018-06-15 01:21:19 +00:00
Set-ItemProperty $SensorState SensorPermissionState -Value 0
2018-06-05 02:06:38 +00:00
If ( ! ( Test-Path $LocationConfig ) ) {
New-Item $LocationConfig
}
2018-06-15 01:21:19 +00:00
Set-ItemProperty $LocationConfig Status -Value 0
2017-12-12 01:37:16 +00:00
#Disables People icon on Taskbar
Write-Output " Disabling People icon on Taskbar "
2018-06-05 02:06:38 +00:00
$People = " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People "
2017-12-12 01:37:16 +00:00
If ( ! ( Test-Path $People ) ) {
2018-06-05 02:06:38 +00:00
New-Item $People
2017-12-12 01:37:16 +00:00
}
2018-06-15 01:21:19 +00:00
Set-ItemProperty $People PeopleBand -Value 0
2017-12-12 01:37:16 +00:00
#Disables scheduled tasks that are considered unnecessary
Write-Output " Disabling scheduled tasks "
2018-06-05 02:06:38 +00:00
Get-ScheduledTask XblGameSaveTaskLogon | Disable-ScheduledTask
Get-ScheduledTask XblGameSaveTask | Disable-ScheduledTask
Get-ScheduledTask Consolidator | Disable-ScheduledTask
Get-ScheduledTask UsbCeip | Disable-ScheduledTask
Get-ScheduledTask DmClient | Disable-ScheduledTask
Get-ScheduledTask DmClientOnScenarioDownload | Disable-ScheduledTask
2018-08-19 06:58:10 +00:00
Write-Output " Stopping and disabling WAP Push Service "
#Stop and disable WAP Push Service
2018-10-05 02:42:20 +00:00
Stop-Service " dmwappushservice "
Set-Service " dmwappushservice " -StartupType Disabled
2018-08-19 06:58:10 +00:00
Write-Output " Stopping and disabling Diagnostics Tracking Service "
#Disabling the Diagnostics Tracking Service
2018-10-05 02:42:20 +00:00
Stop-Service " DiagTrack "
Set-Service " DiagTrack " -StartupType Disabled
2018-06-05 02:06:38 +00:00
}
Function DisableCortana {
2018-10-05 02:42:20 +00:00
Write-Host " Disabling Cortana "
2018-06-05 02:06:38 +00:00
$Cortana1 = " HKCU:\SOFTWARE\Microsoft\Personalization\Settings "
$Cortana2 = " HKCU:\SOFTWARE\Microsoft\InputPersonalization "
$Cortana3 = " HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore "
2018-10-05 02:42:20 +00:00
If ( ! ( Test-Path $Cortana1 ) ) {
New-Item $Cortana1
}
Set-ItemProperty $Cortana1 AcceptedPrivacyPolicy -Value 0
If ( ! ( Test-Path $Cortana2 ) ) {
New-Item $Cortana2
}
Set-ItemProperty $Cortana2 RestrictImplicitTextCollection -Value 1
Set-ItemProperty $Cortana2 RestrictImplicitInkCollection -Value 1
If ( ! ( Test-Path $Cortana3 ) ) {
New-Item $Cortana3
}
2018-08-19 06:58:10 +00:00
Set-ItemProperty $Cortana3 HarvestContacts -Value 0
2018-06-05 02:06:38 +00:00
}
Function EnableCortana {
2018-10-05 02:42:20 +00:00
Write-Host " Re-enabling Cortana "
2018-06-05 02:06:38 +00:00
$Cortana1 = " HKCU:\SOFTWARE\Microsoft\Personalization\Settings "
$Cortana2 = " HKCU:\SOFTWARE\Microsoft\InputPersonalization "
$Cortana3 = " HKCU:\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore "
2018-10-05 02:42:20 +00:00
If ( ! ( Test-Path $Cortana1 ) ) {
New-Item $Cortana1
}
Set-ItemProperty $Cortana1 AcceptedPrivacyPolicy -Value 1
If ( ! ( Test-Path $Cortana2 ) ) {
New-Item $Cortana2
}
Set-ItemProperty $Cortana2 RestrictImplicitTextCollection -Value 0
Set-ItemProperty $Cortana2 RestrictImplicitInkCollection -Value 0
If ( ! ( Test-Path $Cortana3 ) ) {
New-Item $Cortana3
}
Set-ItemProperty $Cortana3 HarvestContacts -Value 1
2017-12-12 01:37:16 +00:00
}
Function Stop-EdgePDF {
2018-06-05 02:06:38 +00:00
#Stops edge from taking over as the default .PDF viewer
Write-Output " Stopping Edge from taking over as the default .PDF viewer "
$NoPDF = " HKCR:\.pdf "
$NoProgids = " HKCR:\.pdf\OpenWithProgids "
$NoWithList = " HKCR:\.pdf\OpenWithList "
If ( ! ( Get-ItemProperty $NoPDF NoOpenWith ) ) {
2018-06-15 01:21:19 +00:00
New-ItemProperty $NoPDF NoOpenWith
2018-06-05 02:06:38 +00:00
}
If ( ! ( Get-ItemProperty $NoPDF NoStaticDefaultVerb ) ) {
2018-06-15 01:21:19 +00:00
New-ItemProperty $NoPDF NoStaticDefaultVerb
2018-06-05 02:06:38 +00:00
}
If ( ! ( Get-ItemProperty $NoProgids NoOpenWith ) ) {
2018-06-15 01:21:19 +00:00
New-ItemProperty $NoProgids NoOpenWith
2018-06-05 02:06:38 +00:00
}
If ( ! ( Get-ItemProperty $NoProgids NoStaticDefaultVerb ) ) {
2018-06-15 01:21:19 +00:00
New-ItemProperty $NoProgids NoStaticDefaultVerb
2018-06-05 02:06:38 +00:00
}
If ( ! ( Get-ItemProperty $NoWithList NoOpenWith ) ) {
2018-06-15 01:21:19 +00:00
New-ItemProperty $NoWithList NoOpenWith
2018-06-05 02:06:38 +00:00
}
If ( ! ( Get-ItemProperty $NoWithList NoStaticDefaultVerb ) ) {
2018-06-15 01:21:19 +00:00
New-ItemProperty $NoWithList NoStaticDefaultVerb
2017-12-12 01:37:16 +00:00
}
2018-06-05 02:06:38 +00:00
2017-12-12 01:37:16 +00:00
#Appends an underscore '_' to the Registry key for Edge
2018-06-05 02:06:38 +00:00
$Edge = " HKCR:\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_ "
If ( Test-Path $Edge ) {
2018-06-15 01:21:19 +00:00
Set-Item $Edge AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_
2017-12-12 01:37:16 +00:00
}
}
2018-06-03 14:20:16 +00:00
2017-12-12 01:37:16 +00:00
Function Revert-Changes {
[ CmdletBinding ( ) ]
Param ( )
#This function will revert the changes you made when running the Start-Debloat function.
#This line reinstalls all of the bloatware that was removed
2018-06-03 14:20:16 +00:00
Get-AppxPackage -AllUsers | ForEach { Add-AppxPackage -Verbose -DisableDevelopmentMode -Register " $( $_ . InstallLocation ) \AppXManifest.xml " }
2018-06-05 02:06:38 +00:00
#Tells Windows to enable your advertising information.
2017-12-12 01:37:16 +00:00
Write-Output " Re-enabling key to show advertisement information "
2018-06-05 02:06:38 +00:00
$Advertising = " HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo "
If ( Test-Path $Advertising ) {
2018-06-15 01:21:19 +00:00
Set-ItemProperty $Advertising Enabled -Value 1
2017-12-12 01:37:16 +00:00
}
#Enables Cortana to be used as part of your Windows Search Function
Write-Output " Re-enabling Cortana to be used in your Windows Search "
2018-06-05 02:06:38 +00:00
$Search = " HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search "
If ( Test-Path $Search ) {
2018-06-15 01:21:19 +00:00
Set-ItemProperty $Search AllowCortana -Value 1
2017-12-12 01:37:16 +00:00
}
#Re-enables the Windows Feedback Experience for sending anonymous data
Write-Output " Re-enabling Windows Feedback Experience "
2018-06-05 02:06:38 +00:00
$Period = " HKCU:\Software\Microsoft\Siuf\Rules "
If ( ! ( Test-Path $Period ) ) {
New-Item $Period
2017-12-12 01:37:16 +00:00
}
2018-06-15 01:21:19 +00:00
Set-ItemProperty $Period PeriodInNanoSeconds -Value 1
2018-06-05 02:06:38 +00:00
#Enables bloatware applications
Write-Output " Adding Registry key to allow bloatware apps to return "
$registryPath = " HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent "
If ( ! ( Test-Path $registryPath ) ) {
New-Item $registryPath
2017-12-12 01:37:16 +00:00
}
2018-06-15 01:21:19 +00:00
Set-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 0
2017-12-12 01:37:16 +00:00
#Changes Mixed Reality Portal Key 'FirstRunSucceeded' to 1
Write-Output " Setting Mixed Reality Portal value to 1 "
2018-06-05 02:06:38 +00:00
$Holo = " HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic "
If ( Test-Path $Holo ) {
2018-06-15 01:21:19 +00:00
Set-ItemProperty $Holo FirstRunSucceeded -Value 1
2017-12-12 01:37:16 +00:00
}
#Re-enables live tiles
Write-Output " Enabling live tiles "
2018-06-05 02:06:38 +00:00
$Live = " HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications "
If ( ! ( Test-Path $Live ) ) {
New-Item $Live
2017-12-12 01:37:16 +00:00
}
2018-06-15 01:21:19 +00:00
Set-ItemProperty $Live NoTileApplicationNotification -Value 0
2018-06-05 02:06:38 +00:00
2017-12-12 01:37:16 +00:00
#Re-enables data collection
Write-Output " Re-enabling data collection "
2018-06-05 02:06:38 +00:00
$DataCollection = " HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection "
If ( ! ( Test-Path $DataCollection ) ) {
New-Item $DataCollection
2017-12-12 01:37:16 +00:00
}
2018-06-15 01:21:19 +00:00
Set-ItemProperty $DataCollection AllowTelemetry -Value 1
2017-12-12 01:37:16 +00:00
#Re-enables People Icon on Taskbar
Write-Output " Enabling People icon on Taskbar "
2018-06-05 02:06:38 +00:00
$People = " HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People "
If ( ! ( Test-Path $People ) ) {
New-Item $People
2017-12-12 01:37:16 +00:00
}
2018-06-15 01:21:19 +00:00
Set-ItemProperty $People PeopleBand -Value 1
2017-12-12 01:37:16 +00:00
#Re-enables suggestions on start menu
Write-Output " Enabling suggestions on the Start Menu "
2018-06-05 02:06:38 +00:00
$Suggestions = " HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager "
If ( ! ( Test-Path $Suggestions ) ) {
New-Item $Suggestions
2017-12-12 01:37:16 +00:00
}
2018-06-15 01:21:19 +00:00
Set-ItemProperty $Suggestions SystemPaneSuggestionsEnabled -Value 1
2017-12-12 01:37:16 +00:00
#Re-enables scheduled tasks that were disabled when running the Debloat switch
Write-Output " Enabling scheduled tasks that were disabled "
2018-06-05 02:06:38 +00:00
Get-ScheduledTask XblGameSaveTaskLogon | Enable-ScheduledTask
Get-ScheduledTask XblGameSaveTask | Enable-ScheduledTask
Get-ScheduledTask Consolidator | Enable-ScheduledTask
Get-ScheduledTask UsbCeip | Enable-ScheduledTask
Get-ScheduledTask DmClient | Enable-ScheduledTask
Get-ScheduledTask DmClientOnScenarioDownload | Enable-ScheduledTask
2018-08-19 06:58:10 +00:00
Write-Output " Re-enabling and starting WAP Push Service "
#Enable and start WAP Push Service
2018-10-05 02:42:20 +00:00
Set-Service " dmwappushservice " -StartupType Automatic
2018-08-19 06:58:10 +00:00
Start-Service " dmwappushservice "
Write-Output " Re-enabling and starting the Diagnostics Tracking Service "
#Enabling the Diagnostics Tracking Service
2018-10-05 02:42:20 +00:00
Set-Service " DiagTrack " -StartupType Automatic
Start-Service " DiagTrack "
2017-12-12 01:37:16 +00:00
}
Function Enable-EdgePDF {
Write-Output " Setting Edge back to default "
2018-06-05 02:06:38 +00:00
$NoPDF = " HKCR:\.pdf "
$NoProgids = " HKCR:\.pdf\OpenWithProgids "
$NoWithList = " HKCR:\.pdf\OpenWithList "
2017-12-12 01:37:16 +00:00
#Sets edge back to default
2018-06-05 02:06:38 +00:00
If ( Get-ItemProperty $NoPDF NoOpenWith ) {
2018-06-15 01:21:19 +00:00
Remove-ItemProperty $NoPDF NoOpenWith
2018-06-05 02:06:38 +00:00
}
If ( Get-ItemProperty $NoPDF NoStaticDefaultVerb ) {
2018-06-15 01:21:19 +00:00
Remove-ItemProperty $NoPDF NoStaticDefaultVerb
2018-06-05 02:06:38 +00:00
}
If ( Get-ItemProperty $NoProgids NoOpenWith ) {
2018-06-15 01:21:19 +00:00
Remove-ItemProperty $NoProgids NoOpenWith
2018-06-05 02:06:38 +00:00
}
If ( Get-ItemProperty $NoProgids NoStaticDefaultVerb ) {
2018-06-15 01:21:19 +00:00
Remove-ItemProperty $NoProgids NoStaticDefaultVerb
2018-06-05 02:06:38 +00:00
}
If ( Get-ItemProperty $NoWithList NoOpenWith ) {
2018-06-15 01:21:19 +00:00
Remove-ItemProperty $NoWithList NoOpenWith
2018-06-05 02:06:38 +00:00
}
If ( Get-ItemProperty $NoWithList NoStaticDefaultVerb ) {
2018-06-15 01:21:19 +00:00
Remove-ItemProperty $NoWithList NoStaticDefaultVerb
2017-12-12 01:37:16 +00:00
}
#Removes an underscore '_' from the Registry key for Edge
2018-06-05 02:06:38 +00:00
$Edge2 = " HKCR:\AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723_ "
If ( Test-Path $Edge2 ) {
2018-06-15 01:21:19 +00:00
Set-Item $Edge2 AppXd4nrz8ff68srnhf9t5a8sbjyar1cr723
2017-12-12 01:37:16 +00:00
}
}
2017-12-12 04:23:24 +00:00
2018-02-19 15:48:42 +00:00
Function FixWhitelistedApps {
[ CmdletBinding ( ) ]
Param ( )
2018-03-07 04:31:11 +00:00
If ( ! ( Get-AppxPackage -AllUsers | Select Microsoft . Paint3D , Microsoft . WindowsCalculator , Microsoft . WindowsStore , Microsoft . Windows . Photos ) ) {
2018-02-19 15:48:42 +00:00
2018-03-07 04:31:11 +00:00
#Credit to abulgatz for these 4 lines of code
Get-AppxPackage -allusers Microsoft . Paint3D | Foreach { Add-AppxPackage -DisableDevelopmentMode -Register " $( $_ . InstallLocation ) \AppXManifest.xml " }
Get-AppxPackage -allusers Microsoft . WindowsCalculator | Foreach { Add-AppxPackage -DisableDevelopmentMode -Register " $( $_ . InstallLocation ) \AppXManifest.xml " }
Get-AppxPackage -allusers Microsoft . WindowsStore | Foreach { Add-AppxPackage -DisableDevelopmentMode -Register " $( $_ . InstallLocation ) \AppXManifest.xml " }
Get-AppxPackage -allusers Microsoft . Windows . Photos | Foreach { Add-AppxPackage -DisableDevelopmentMode -Register " $( $_ . InstallLocation ) \AppXManifest.xml " }
}
}
2018-06-05 02:06:38 +00:00
Function UninstallOneDrive {
2018-08-19 06:22:07 +00:00
Write-Output " Uninstalling OneDrive "
New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
2018-06-05 02:06:38 +00:00
$onedrive = " $env:SYSTEMROOT \SysWOW64\OneDriveSetup.exe "
$ExplorerReg1 = " HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6} "
$ExplorerReg2 = " HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6} "
2018-10-05 02:42:20 +00:00
Stop-Process -Name " OneDrive* "
Start-Sleep 2
If ( ! ( Test-Path $onedrive ) ) {
$onedrive = " $env:SYSTEMROOT \System32\OneDriveSetup.exe "
}
Start-Process $onedrive " /uninstall " -NoNewWindow -Wait
Start-Sleep 2
2018-06-05 02:06:38 +00:00
Write-Output " Stopping explorer "
Start-Sleep 1
2018-10-05 02:42:20 +00:00
. \ taskkill . exe / F / IM explorer . exe
Start-Sleep 3
2018-06-05 02:06:38 +00:00
Write-Output " Removing leftover files "
2018-10-05 02:42:20 +00:00
Remove-Item " $env:USERPROFILE \OneDrive " -Force -Recurse
Remove-Item " $env:LOCALAPPDATA \Microsoft\OneDrive " -Force -Recurse
Remove-Item " $env:PROGRAMDATA \Microsoft OneDrive " -Force -Recurse
If ( Test-Path " $env:SYSTEMDRIVE \OneDriveTemp " ) {
Remove-Item " $env:SYSTEMDRIVE \OneDriveTemp " -Force -Recurse
}
2018-06-05 02:06:38 +00:00
Write-Output " Removing OneDrive from windows explorer "
If ( ! ( Test-Path $ExplorerReg1 ) ) {
New-Item $ExplorerReg1
}
2018-06-15 01:21:19 +00:00
Set-ItemProperty $ExplorerReg1 System . IsPinnedToNameSpaceTree -Value 0
2018-06-05 02:06:38 +00:00
If ( ! ( Test-Path $ExplorerReg2 ) ) {
New-Item $ExplorerReg2
}
2018-06-15 01:21:19 +00:00
Set-ItemProperty $ExplorerReg2 System . IsPinnedToNameSpaceTree -Value 0
2018-06-05 02:06:38 +00:00
Write-Output " Restarting Explorer that was shut down before. "
2018-10-05 02:42:20 +00:00
Start-Process explorer . exe -NoNewWindow
2018-06-05 02:06:38 +00:00
}
2018-02-19 15:48:42 +00:00
2018-06-03 14:20:16 +00:00
#GUI prompt Debloat/Revert options and GUI variables
2018-06-03 15:38:23 +00:00
$Button = [ Windows.MessageBoxButton ] :: YesNoCancel
2018-06-03 14:20:16 +00:00
$ErrorIco = [ Windows.MessageBoxImage ] :: Error
$Warn = [ Windows.MessageBoxImage ] :: Warning
2018-06-03 15:38:23 +00:00
$Ask = ' The following will allow you to either Debloat Windows 10 or to revert changes made after Debloating Windows 10 .
Select " Yes " to Debloat Windows 10
Select " No " to Revert changes made by this script
Select " Cancel " to stop the script . '
2018-10-05 02:42:20 +00:00
$EverythingorSpecific = " Would you like to remove everything that was preinstalled on your Windows Machine? Select Yes to remove everything, or select No to remove apps via a blacklist. "
2018-06-05 02:06:38 +00:00
$EdgePdf = " Do you want to stop edge from taking over as the default PDF viewer? "
$EdgePdf2 = " Do you want to revert changes that disabled Edge as the default PDF viewer? "
$Reboot = " For some of the changes to properly take effect it is recommended to reboot your machine. Would you like to restart? "
$OneDriveDelete = " Do you want to uninstall One Drive? "
2018-06-03 14:20:16 +00:00
2018-10-05 02:42:20 +00:00
$Prompt1 = [ Windows.MessageBox ] :: Show ( $Ask , " Debloat or Revert " , $Button , $ErrorIco )
2018-06-03 14:20:16 +00:00
Switch ( $Prompt1 ) {
2018-03-07 04:31:11 +00:00
#This will debloat Windows 10
2018-06-03 14:20:16 +00:00
Yes {
2018-10-05 02:42:20 +00:00
$Prompt2 = [ Windows.MessageBox ] :: Show ( $EverythingorSpecific , " Everything or Specific " , $Button , $Warn )
switch ( $Prompt2 ) {
Yes {
#Creates a "drive" to access the HKCR (HKEY_CLASSES_ROOT)
Write-Output " Creating PSDrive 'HKCR' (HKEY_CLASSES_ROOT). This will be used for the duration of the script as it is necessary for the removal and modification of specific registry keys. "
New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
Start-Sleep 1
Write-Output " Uninstalling bloatware, please wait. "
2018-10-05 04:04:40 +00:00
DebloatAll
2018-10-05 02:42:20 +00:00
Write-Output " Bloatware removed. "
Start-Sleep 1
Write-Output " Removing specific registry keys. "
Remove-Keys
Write-Output " Leftover bloatware registry keys removed. "
Start-Sleep 1
Write-Output " Checking to see if any Whitelisted Apps were removed, and if so re-adding them. "
Start-Sleep 1
FixWhitelistedApps
Start-Sleep 1
Write-Output " Disabling Cortana from search, disabling feedback to Microsoft, and disabling scheduled tasks that are considered to be telemetry or unnecessary. "
Protect-Privacy
Start-Sleep 1
DisableCortana
Write-Output " Cortana disabled and removed from search, feedback to Microsoft has been disabled, and scheduled tasks are disabled. "
Start-Sleep 1
Write-Output " Stopping and disabling Diagnostics Tracking Service "
DisableDiagTrack
Write-Output " Diagnostics Tracking Service disabled "
Start-Sleep 1
Write-Output " Disabling WAP push service "
Start-Sleep 1
DisableWAPPush
Write-Output " WAP push service stopped and disabled "
Start-Sleep 1 ; = $Debloat
}
No {
#Creates a "drive" to access the HKCR (HKEY_CLASSES_ROOT)
Write-Output " Creating PSDrive 'HKCR' (HKEY_CLASSES_ROOT). This will be used for the duration of the script as it is necessary for the removal and modification of specific registry keys. "
New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
Start-Sleep 1
Write-Output " Uninstalling bloatware, please wait. "
DebloatBlacklist
Write-Output " Bloatware removed. "
Start-Sleep 1
Write-Output " Removing specific registry keys. "
Remove-Keys
Write-Output " Leftover bloatware registry keys removed. "
Start-Sleep 1
Write-Output " Checking to see if any Whitelisted Apps were removed, and if so re-adding them. "
Start-Sleep 1
FixWhitelistedApps
Start-Sleep 1
Write-Output " Disabling Cortana from search, disabling feedback to Microsoft, and disabling scheduled tasks that are considered to be telemetry or unnecessary. "
Protect-Privacy
Start-Sleep 1
DisableCortana
Write-Output " Cortana disabled and removed from search, feedback to Microsoft has been disabled, and scheduled tasks are disabled. "
Start-Sleep 1
Write-Output " Stopping and disabling Diagnostics Tracking Service "
DisableDiagTrack
Write-Output " Diagnostics Tracking Service disabled "
Start-Sleep 1
Write-Output " Disabling WAP push service "
Start-Sleep 1
DisableWAPPush
Write-Output " WAP push service stopped and disabled "
Start-Sleep 1 ; = $Debloat
}
}
$Prompt3 = [ Windows.MessageBox ] :: Show ( $EdgePdf , " Edge PDF " , $Button , $Warn )
Switch ( $Prompt3 ) {
2018-03-07 04:31:11 +00:00
Yes {
Stop-EdgePDF
2018-08-19 06:58:10 +00:00
Write-Output " Edge will no longer take over as the default PDF viewer. " ; = $Yes
2017-12-12 01:37:16 +00:00
}
2018-03-07 04:31:11 +00:00
No {
2018-10-05 02:42:20 +00:00
= $No
2018-03-07 04:31:11 +00:00
}
2018-06-05 02:06:38 +00:00
Cancel {
}
2018-03-07 04:31:11 +00:00
}
2018-06-05 02:06:38 +00:00
#Prompt asking to delete OneDrive
2018-10-05 02:42:20 +00:00
$Prompt4 = [ Windows.MessageBox ] :: Show ( $OneDriveDelete , " Delete OneDrive " , $Button , $ErrorIco )
Switch ( $Prompt4 ) {
2018-06-05 02:06:38 +00:00
Yes {
UninstallOneDrive
2018-08-19 06:58:10 +00:00
Write-Output " OneDrive is now removed from the computer. " ; = $Yes
2018-06-05 02:06:38 +00:00
}
No {
2018-10-05 02:42:20 +00:00
= $No
2018-06-05 02:06:38 +00:00
}
Cancel {
}
}
#Prompt asking if you'd like to reboot your machine
2018-10-05 02:42:20 +00:00
$Prompt5 = [ Windows.MessageBox ] :: Show ( $Reboot , " Reboot " , $Button , $Warn )
Switch ( $Prompt5 ) {
2018-03-07 04:31:11 +00:00
Yes {
Write-Output " Unloading the HKCR drive... "
Remove-PSDrive HKCR
Start-Sleep 1
Stop-Transcript
Write-Output " Initiating reboot. "
Start-Sleep 2
2018-08-19 06:58:10 +00:00
Restart-Computer ; = $Yes
2017-12-12 04:23:24 +00:00
}
2018-03-07 04:31:11 +00:00
No {
Write-Output " Unloading the HKCR drive... "
Remove-PSDrive HKCR
Start-Sleep 1
Stop-Transcript
Write-Output " Script has finished. Exiting. "
Start-Sleep 2
2018-08-19 06:58:10 +00:00
Exit ; = $No
2017-12-12 04:23:24 +00:00
}
2018-06-05 02:06:38 +00:00
Cancel {
}
2017-12-12 04:23:24 +00:00
}
}
2018-06-03 14:20:16 +00:00
No {
2018-03-07 04:31:11 +00:00
Write-Output " Reverting changes... "
Write-Output " Creating PSDrive 'HKCR' (HKEY_CLASSES_ROOT). This will be used for the duration of the script as it is necessary for the modification of specific registry keys. "
2018-06-05 02:06:38 +00:00
New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
2018-08-19 06:58:10 +00:00
Revert-Changes ; = $Revert
2018-06-03 14:20:16 +00:00
#Prompt asking to revert edge changes as well
2018-10-05 02:42:20 +00:00
$Prompt6 = [ Windows.MessageBox ] :: Show ( $EdgePdf2 , " Revert Edge " , $Button , $ErrorIco )
Switch ( $Prompt6 ) {
2018-03-07 04:31:11 +00:00
Yes {
Enable-EdgePDF
2018-08-19 06:58:10 +00:00
Write-Output " Edge will no longer be disabled from being used as the default Edge PDF viewer. " ; = $Yes
2018-03-07 04:31:11 +00:00
}
2018-10-05 02:42:20 +00:00
No {
= $No
2018-06-05 02:06:38 +00:00
}
Cancel {
}
2018-03-07 04:31:11 +00:00
}
2018-06-03 14:20:16 +00:00
#Prompt asking if you'd like to reboot your machine
2018-10-05 02:42:20 +00:00
$Prompt7 = [ Windows.MessageBox ] :: Show ( $Reboot , " Reboot " , $Button , $Warn )
Switch ( $Prompt7 ) {
2018-03-07 04:31:11 +00:00
Yes {
Write-Output " Unloading the HKCR drive... "
Remove-PSDrive HKCR
Start-Sleep 1
Write-Output " Initiating reboot. "
2017-12-12 04:23:24 +00:00
Stop-Transcript
2018-03-07 04:31:11 +00:00
Start-Sleep 2
2018-08-19 06:58:10 +00:00
Restart-Computer ; = $Yes
2017-12-12 04:23:24 +00:00
}
2018-03-07 04:31:11 +00:00
No {
2017-12-12 04:23:24 +00:00
Write-Output " Unloading the HKCR drive... "
2018-03-07 04:31:11 +00:00
Remove-PSDrive HKCR
Start-Sleep 1
Write-Output " Script has finished. Exiting. "
2017-12-12 04:23:24 +00:00
Stop-Transcript
2018-03-07 04:31:11 +00:00
Start-Sleep 2
2018-08-19 06:58:10 +00:00
Exit ; = $No
2017-12-12 01:37:16 +00:00
}
2018-06-05 02:06:38 +00:00
Cancel {
}
2017-12-12 01:37:16 +00:00
}
}
2018-06-03 15:38:23 +00:00
Cancel {
}
2018-03-07 04:31:11 +00:00
}