Improving Windows 10 Privacy

I simply don't need all of the web enabled "features" on all of my windows 10 devices. (Save data, privacy, less network footprint etc... ) So, after a little sleuthing I have cobbled together a *.bat file to reduce this a bit. A good portion comes from the comments section of the following website from users named Wade and Alup:
https://winaero.com/blog/how-to-disable-telemetry-and-data-collection-in-windows-10/

I have added a few of my own edits, such as, the ability to revert the changes, turning on/off the web search feature in the search bar. I also commented out where the script attempts to block microsoft urls. (You can uncomment them to enable the blocking if you want)

You will need to prevent your anti-virus (at least if windows defender) from removing/blocking the bat file.

You can review, copy and paste the following into a file (script.bat). Then run it from administrator mode in the command prompt (cmd)

I take no responsibility for any harm this may cause. It works well on my systems. (The cloud disabled ones) You will likely need to re-run it after updates. Don't expect this to completely stealth your computer on a network either...Do your own network audits!



@echo off

Title Disable Windows Spy Services. Created by Alup, concept by Wade, edited by Tim.
color 0a
Echo This batch file will stop and prevent Microsoft from
Echo spying on your personal data.
Echo.
Echo It does this by disabling services and adding registry keys.
Echo If you are un-easy about running this then just close it,
Echo Otherwise...
Echo.
Echo.
Echo.
Echo.
Echo.
Echo.
Echo.
Echo.
Echo.
Echo.
Echo.
Echo.
Echo.
Echo.
Echo.
Echo.
Echo Lets Check to see if you are being spied on...
pause
cls
REG QUERY "HKLM\SYSTEM\CurrentControlSet\Services\DiagTrack" /v Start | Find "0x4"
echo %ERRORLEVEL%

IF %ERRORLEVEL% == 1 goto yes
If %ERRORLEVEL% == 0 goto no

:no
CMD /C EXIT 0
cls
color 0a
Echo Congrats, you have NOT been sending data to Microsoft
SET /P answer="Would you like to ENABLE Windows Telemetry? (y/n/?)"
if /i "%answer:~,1%" EQU "y" goto fix
if /i "%answer:~,1%" EQU "n" goto exit
if /i "%answer:~,1%" EQU "D" goto cleanup
echo Please type y for Yes or n for No. ( If there is an error type D to disable telemetry)

Echo Your computer is Spy Free and you do not need to run this script.
pause
goto exit

:yes
CMD /C EXIT 0
cls
color 0c
Echo OH NO!!! It looks like you have been sending data to Microsoft.
SET /P answer="Would you like to DISABLE Windows Telemetry? (y/n/?)"
if /i "%answer:~,1%" EQU "y" goto cleanup
if /i "%answer:~,1%" EQU "n" goto exit
if /i "%answer:~,1%" EQU "E" goto fix
echo Please type y for Yes or n for No. (If there is an error type E to enable telemetry)
pause
goto yes

:cleanup
Echo Lets Clean this up.
pause
color 07
Echo Stopping DiagTrack...
sc stop "DiagTrack"
Echo Disabling DiagTrack...
sc config "DiagTrack" start= disabled
Echo.
Echo.
Echo Stopping Windows Push Service...
sc stop "dmwappushservice"
Echo Disabling Windows Push Service...
sc config "dmwappushservice" start= disabled
Echo.
Echo.
Echo Preventing Windows from re-enabling these services...
REG ADD HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection /f /v AllowTelemetry /t REG_DWORD /d 0
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\DiagTrack /f /v Start /t REG_DWORD /d 4
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\DiagTrack /f /v Type /t REG_DWORD /d 10
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\DiagTrack /f /v ServiceSidType /t REG_DWORD /d 1
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\DiagTrack /f /v ServiceDllUnloadOnStop /t REG_DWORD /d 1
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\dmwappushservice /f /v DelayedAutoStart /t REG_DWORD /d 0
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\dmwappushservice /f /v Start /t REG_DWORD /d 4
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\dmwappushservice /f /v Type /t REG_DWORD /d 20
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\dmwappushservice /f /v ServiceSidType /t REG_DWORD /d 1
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\dmwappushservice\Parameters /f /v ServiceDllUnloadOnStop /t REG_DWORD /d 1
REG ADD HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo\ /v Enabled /t REG_DWORD /d 0 /f
REG DELETE HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo\ /v Id /f
REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo\ /v Enabled /t REG_DWORD /d 0 /f
REG ADD HKCU\Software\Microsoft\Windows\CurrentVersion\search /v BingSearchEnabled /t REG_DWORD /d 0 /f
REG ADD HKCU\Software\Microsoft\Windows\CurrentVersion\search /v AllowSearchToUseLocation /t REG_DWORD /d 0 /f
REG ADD HKCU\Software\Microsoft\Windows\CurrentVersion\search /v CortanaConsent /t REG_DWORD /d 0 /f

REG ADD "HKCU\Control Panel\International\User Profile\ /v HttpAcceptLanguageOptOut" /t REG_DWORD /d 1 /f
REG ADD HKCU\SOFTWARE\Microsoft\InputPersonalization\ /v RestrictImplicitTextCollection /t REG_DWORD /d 1 /f
REG ADD HKCU\SOFTWARE\Microsoft\InputPersonalization\ /v RestrictImplicitInkCollection /t REG_DWORD /d 1 /f
REG ADD HKCU\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore\ /v HarvestContacts /t REG_DWORD /d 0 /f
REG ADD HKCU\SOFTWARE\Microsoft\Personalization\Settings\ /v AcceptedPrivacyPolicy /t REG_DWORD /d 0 /f


Echo.
Echo.
REM Echo Adding Black list sites to the HOSTS file.
REM echo ## BEGIN Windows 10 privacy settings ##>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 vortex.data.microsoft.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 vortex-win.data.microsoft.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 telecommand.telemetry.microsoft.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 telecommand.telemetry.microsoft.com.nsatc.net>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 oca.telemetry.microsoft.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 oca.telemetry.microsoft.com.nsatc.net>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 sqm.telemetry.microsoft.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 sqm.telemetry.microsoft.com.nsatc.net>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 watson.telemetry.microsoft.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 watson.telemetry.microsoft.com.nsatc.net>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 redir.metaservices.microsoft.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 choice.microsoft.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 choice.microsoft.com.nsatc.net>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 df.telemetry.microsoft.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 reports.wes.df.telemetry.microsoft.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 wes.df.telemetry.microsoft.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 services.wes.df.telemetry.microsoft.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 sqm.df.telemetry.microsoft.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 telemetry.microsoft.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 watson.ppe.telemetry.microsoft.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 telemetry.appex.bing.net>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 telemetry.urs.microsoft.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 telemetry.appex.bing.net:443>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 settings-sandbox.data.microsoft.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 vortex-sandbox.data.microsoft.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 survey.watson.microsoft.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 watson.live.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 watson.microsoft.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 statsfe2.ws.microsoft.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 corpext.msitadfs.glbdns2.microsoft.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 compatexchange.cloudapp.net>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 cs1.wpc.v0cdn.net>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 a-0001.a-msedge.net>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 statsfe2.update.microsoft.com.akadns.net>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 diagnostics.support.microsoft.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 corp.sts.microsoft.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 statsfe1.ws.microsoft.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 pre.footprintpredict.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 i1.services.social.microsoft.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 i1.services.social.microsoft.com.nsatc.net>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 bingads.microsoft.com>>%windir%\system32\drivers\etc\hosts
REM echo 0.0.0.0 www.bingads.microsoft.com>>%windir%\system32\drivers\etc\hosts
REM echo ## END Windows 10 privacy settings ##>>%windir%\system32\drivers\etc\hosts
REM Echo.
REM Echo.
REM Echo Renaming the services to what they should be named.
REM Echo “Windows Spy Service 1 and 2”
REM REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DiagTrack /f /v DisplayName /t REG_SZ /d “Windows Spy Service 1”
REM REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\dmwappushservice /f /v DisplayName /t REG_SZ /d “Windows Spy Service 2”
CMD /C EXIT 0

REG QUERY "HKLM\SYSTEM\CurrentControlSet\Services\dmwappushservice" /v Start | Find "0x4"

IF %ERRORLEVEL% == 1 goto failed
If %ERRORLEVEL% == 0 goto finish

:failed
pause
cls
Echo It looks like I failed to run properly.
Echo Did you make sure to run this as Administrator?
pause
goto exit

:finish
pause
cls
color 0a
Echo Congrats your computer is Microsoft Spy Free! Enjoy!
Echo Do not forget to restart your computer to complete the process.
Pause
goto exit


:fix
rem Windows 10 enable telemetry services and enable data collection
rem run as Administrator

REM Revert registry settings

REG DELETE HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection /v AllowTelemetry /f
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\DiagTrack /v Start /t REG_DWORD /d 2 /f
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\DiagTrack /v Type /t REG_DWORD /d 10 /f
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\DiagTrack /v ServiceSidType /t REG_DWORD /d 1 /f
REG DELETE HKLM\SYSTEM\CurrentControlSet\Services\DiagTrack /v ServiceDllUnloadOnStop /f

REG DELETE HKCU\Software\Microsoft\Windows\CurrentVersion\search /v BingSearchEnabled /f
REG DELETE HKCU\Software\Microsoft\Windows\CurrentVersion\search /v AllowSearchToUseLocation /f
REG DELETE HKCU\Software\Microsoft\Windows\CurrentVersion\search /v CortanaConsent /f

REG ADD HKLM\SYSTEM\CurrentControlSet\Services\dmwappushservice /v DelayedAutoStart /t REG_DWORD /d 1 /f
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\dmwappushservice /v Start /t REG_DWORD /d 3 /f
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\dmwappushservice /v Type /t REG_DWORD /d 20 /f
REG DELETE HKLM\SYSTEM\CurrentControlSet\Services\dmwappushservice /v ServiceSidType /f
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\dmwappushservice\Parameters /v ServiceDllUnloadOnStop /t REG_DWORD /d 1 /f

REG DELETE HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo /f
REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo\ /v Enabled /t REG_DWORD /d 0 /f

REG ADD "HKCU\Control Panel\International\User Profile\ /v HttpAcceptLanguageOptOut" /t REG_DWORD /d 1 /f

REG Delete HKCU\SOFTWARE\Microsoft\InputPersonalization\ /v RestrictImplicitTextCollection /f
REG Delete HKCU\SOFTWARE\Microsoft\InputPersonalization\ /v RestrictImplicitInkCollection /f
REG Delete HKCU\SOFTWARE\Microsoft\InputPersonalization\TrainedDataStore\ /v HarvestContacts /f
REG ADD HKCU\SOFTWARE\Microsoft\Personalization\Settings\ /v AcceptedPrivacyPolicy /t REG_DWORD /d 0 /f

sc config DiagTrack start= auto
sc config dmwappushservice start= delayed-auto

sc start DiagTrack
sc start dmwappushservice
pause

:exit
REM Finished.
pause

Comments

Popular posts from this blog

Fail2ban Rules for Foundry VTT

Fail2ban Behind Reverse Proxy

Leadership Training 2