@echo off | |
title "Disable Windows 7/8/8.1 Telemetry" | |
endlocal & setlocal EnableDelayedExpansion | |
rem Script created by <github.com/tarampampam> # 2015 | |
rem Github: <https://gist.github.com/tarampampam/a0db45fb0de5976300b1> | |
rem OS: Windows 7/8/8.1 | |
rem Version 0.2.14 | |
echo. | |
echo *************************************************************************** | |
echo * * | |
echo * Disable Windows 7/8/8.1 Telemetry (+bonus) service * | |
echo * * | |
echo *************************************************************************** | |
echo * * | |
echo * Script support arguments: * | |
echo * * | |
echo * -kb ^| -hotfixes Do NOT uninstall updates * | |
echo * -d ^| -disable Do NOT disable updates * | |
echo * -t ^| -tasks Do NOT disable tasks * | |
echo * -s ^| -services Do NOT disable services * | |
echo * -i ^| -ip Do NOT block IP addresses using route * | |
echo * -f ^| -firewall Do NOT block IP addresses using firewall * | |
echo * -h ^| -hosts Do NOT add domains to hosts file * | |
echo * -u ^| -updates Do NOT change windows update settings * | |
echo * -l ^| -log Do NOT write messages to .log file * | |
echo * -e ^| -exit Exit when work is complete * | |
echo * * | |
echo * Latest version you can find here: ^<http://goo.gl/1MzPtW^> * | |
echo * * | |
echo *************************************************************************** | |
echo * * | |
echo * PLEASE DISABLE YOUR ANTIVIRUS SOFTWARE BEFORE^^! * | |
echo * (Sometimes it block access to hosts file, etc) * | |
echo * * | |
echo *************************************************************************** | |
echo. | |
rem Setup default script settings + declare variables | |
set ExitOnComplete=0 | |
set WriteLogFile=1 | |
set UninstallUpdates=1 | |
set DisableUpdates=1 | |
set DisableTasks=1 | |
set DisableServices=1 | |
set BlockIPaddresses=1 | |
set BlockIPaddressesWithFirewall=1 | |
set AddDomainsToHosts=1 | |
set DisableAutomaticUpdates=1 | |
set FirewallIPlist= | |
set UpdatesList= | |
set result= | |
set LogFilePath="%~f0.log" | |
rem Parse passed arguments to script | |
:parse_passed_params | |
if "%~1"=="" goto end_parse_passed_params | |
if "%~1"=="-e" set ExitOnComplete=1 | |
if "%~1"=="-exit" set ExitOnComplete=1 | |
if "%~1"=="-kb" set UninstallUpdates=0 | |
if "%~1"=="-hotfixes" set UninstallUpdates=0 | |
if "%~1"=="-d" set DisableUpdates=0 | |
if "%~1"=="-disable" set DisableUpdates=0 | |
if "%~1"=="-t" set DisableTasks=0 | |
if "%~1"=="-tasks" set DisableTasks=0 | |
if "%~1"=="-s" set DisableServices=0 | |
if "%~1"=="-services" set DisableServices=0 | |
if "%~1"=="-i" set BlockIPaddresses=0 | |
if "%~1"=="-ip" set BlockIPaddresses=0 | |
if "%~1"=="-f" set BlockIPaddressesWithFirewall=0 | |
if "%~1"=="-firewall" set BlockIPaddressesWithFirewall=0 | |
if "%~1"=="-h" set AddDomainsToHosts=0 | |
if "%~1"=="-hosts" set AddDomainsToHosts=0 | |
if "%~1"=="-u" set DisableAutomaticUpdates=0 | |
if "%~1"=="-updates" set DisableAutomaticUpdates=0 | |
if "%~1"=="-l" set WriteLogFile=0 | |
if "%~1"=="-log" set WriteLogFile=0 | |
shift & goto parse_passed_params | |
:end_parse_passed_params | |
goto:checkPermissions | |
:begin | |
if %UninstallUpdates%==1 ( | |
call:title "Uninstall evil M$ updates.." | |
rem You can find KB description here: https://support.microsoft.com/en-us/kb/%KB_NUMBER% | |
rem 3080149 - Update for customer experience and diagnostic telemetry // 8.1 / WS 2012 R2, 7 SP1 / WS 2008 R2 SP1 | |
rem 3075249 - Update that adds telemetry points to consent.exe in Windows 8.1 and Windows 7 // 8.1 / RT 8.1 / WS 2012 R2 / 7 SP1 / WS 2008 R2 SP1 | |
rem 2952664 - Compatibility update for upgrading Windows 7 // 7 SP1 | |
rem 3035583 - Update installs Get Windows 10 app in Windows 8.1 and Windows 7 SP1 // 8.1 / 7 SP1 / IE11 | |
rem 3068708 - Update for customer experience and diagnostic telemetry // 8.1 / WS 2012 R2 / 7 SP1 / WS 2008 R2 SP1 | |
rem 3022345 - Update for customer experience and diagnostic telemetry // WS 2012 R2 / 8.1 / WS 2008 R2 SP1 / 7 SP1 | |
rem 3021917 - Update to Windows 7 SP1 for performance improvements // 7 SP1 | |
rem 2976978 - Compatibility update for Windows 8.1 and Windows 8 // 8 / 8.1 | |
rem 3044374 - Update that enables you to upgrade from Windows 8.1 to Windows 10 // WS 2012 R2 / 8.1 | |
rem 2990214 - Update that enables you to upgrade from Windows 7 to a later version of Windows // WS 2008 R2 SP1 / 7 SP1 | |
rem 971033 - Update for Windows Activation Technologies // 7 | |
rem 3075851 - Windows Update Client for Windows 7 and Windows Server 2008 R2: August 2015 // WS 2008 R2 SP1 / 7 SP1 / Embedded Standard 7 SP1 | |
rem 3065988 - Windows Update Client for Windows 8.1 and Windows Server 2012 R2: July 2015 more info // WS 2012 R2 / 8.1 | |
rem 3083325 - Windows Update Client for Windows 8.1 and Windows Server 2012 R2: September 2015 more info // WS 2012 R2 / 8.1 | |
rem 3083324 - Windows Update Client for Windows 7 and Windows Server 2008 R2: September 2015 more info // WS 2008 R2 / 7 | |
rem 3075853 - Windows Update Client for Windows 8.1 and Windows Server 2012 R2: August 2015 more info // WS 2012 R2 / 8.1 | |
rem 3065987 - Windows Update Client for Windows 7 and Windows Server 2008 R2: July 2015 more info // WS 2008 R2 / 7 | |
rem 3050265 - Windows Update Client for Windows 7: June 2015 more info // WS 2008 R2 / 7 | |
rem 3050267 - Windows Update Client for Windows 8.1: June 2015 more info // WS 2012 R2 / 8.1 | |
rem 3046480 - Update helps to determine whether to migrate the .NET Framework 1.1 when you upgrade Windows 8.1 or Windows 7 more info // 7 SP1 / 8.1 | |
rem 2882822 - Update adds ITraceRelogger interface support // 7 SP1 / WS 2008 R2 | |
rem 3083710 - Windows Update Client for Windows 7 and Windows Server 2008 R2: October 2015 // 7 SP1 / WS 2008 R2 | |
rem 3083711 - Windows Update Client for Windows 8.1 and Windows Server 2012 R2: October 2015 // 8.1 / WS 2012 R2 | |
rem 3112343 - Windows Update Client for Windows 7 and Windows Server 2008 R2: December 2015 // 7 / WS 2008 R2 | |
rem 3112336 - Windows Update Client for Windows 8.1 and Windows Server 2012 R2: December 2015 // 8.1 / WS 2012 R2 | |
rem 3112336 - Updated capabilities to upgrade Windows 8.1 and Windows 7 // 8.1 / 7 SP1 | |
rem 3112336 - Windows Update Client for Windows 7 and Windows Server 2008 R2: February 2016 // 7 SP1 / WS 2008 R2 / Embedded Standard 7 SP1 | |
for %%? in ( | |
"3080149" | |
"3075249" | |
"2952664" | |
"3035583" | |
"3068708" | |
"3022345" | |
"3021917" | |
"2976978" | |
"3044374" | |
"2990214" | |
"971033" | |
"3075851" | |
"3065988" | |
"3083325" | |
"3083324" | |
"3075853" | |
"3065987" | |
"3050265" | |
"3050267" | |
"3046480" | |
"2882822" | |
"3083710" | |
"3083711" | |
"3112343" | |
"3112336" | |
"3135445" | |
"3123862" | |
) do call:uninstall_update %%? | |
) | |
if %DisableUpdates%==1 ( | |
call:title "Disable ^(hide^) uninstalled updates.." | |
call:log "It can take a lot of time - wait please, or use -d flag for disable this feature.." "Notice" | |
rem For using this shit you must init updates list by calling 'call:uninstall_update "123123"' first! | |
call:disable_updates | |
) | |
if %DisableTasks%==1 ( | |
call:title "Disable some windows tasks.." | |
for %%? in ( | |
"\Microsoft\Windows\Application Experience\AitAgent" | |
"\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser" | |
"\Microsoft\Windows\Application Experience\ProgramDataUpdater" | |
"\Microsoft\Windows\Autochk\Proxy" | |
"\Microsoft\Windows\Customer Experience Improvement Program\Consolidator" | |
"\Microsoft\Windows\Customer Experience Improvement Program\KernelCeipTask" | |
"\Microsoft\Windows\Customer Experience Improvement Program\UsbCeip" | |
"\Microsoft\Windows\DiskDiagnostic\Microsoft-Windows-DiskDiagnosticDataCollector" | |
"\Microsoft\Windows\PI\Sqm-Tasks" | |
"\Microsoft\Windows\Power Efficiency Diagnostics\AnalyzeSystem" | |
"\Microsoft\Windows\Windows Error Reporting\QueueReporting" | |
"\Microsoft\Windows\Maintenance\WinSAT" | |
"\Microsoft\Windows\Media Center\ActivateWindowsSearch" | |
"\Microsoft\Windows\Media Center\ConfigureInternetTimeService" | |
"\Microsoft\Windows\Media Center\DispatchRecoveryTasks" | |
"\Microsoft\Windows\Media Center\ehDRMInit" | |
"\Microsoft\Windows\Media Center\InstallPlayReady" | |
"\Microsoft\Windows\Media Center\mcupdate" | |
"\Microsoft\Windows\Media Center\MediaCenterRecoveryTask" | |
"\Microsoft\Windows\Media Center\ObjectStoreRecoveryTask" | |
"\Microsoft\Windows\Media Center\OCURActivate" | |
"\Microsoft\Windows\Media Center\OCURDiscovery" | |
"\Microsoft\Windows\Media Center\PBDADiscovery" | |
"\Microsoft\Windows\Media Center\PBDADiscoveryW1" | |
"\Microsoft\Windows\Media Center\PBDADiscoveryW2" | |
"\Microsoft\Windows\Media Center\PvrRecoveryTask" | |
"\Microsoft\Windows\Media Center\PvrScheduleTask" | |
"\Microsoft\Windows\Media Center\RegisterSearch" | |
"\Microsoft\Windows\Media Center\ReindexSearchRoot" | |
"\Microsoft\Windows\Media Center\SqlLiteRecoveryTask" | |
"\Microsoft\Windows\Media Center\UpdateRecordPath" | |
) do call:disable_task %%? | |
) | |
if %DisableServices%==1 ( | |
call:title "Disable services.." | |
for %%? in ( | |
"Diagtrack" | |
"dmwappushservice" | |
"WerSvc" | |
) do call:disable_service %%? | |
set RegDataCollection="HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DataCollection" | |
reg query !RegDataCollection!>nul 2>&1 & if %errorLevel%==0 ( | |
reg add !RegDataCollection! /v AllowTelemetry /t REG_DWORD /d 0 /f >nul | |
) | |
set RegWindowsReporting="HKEY_CURRENT_USER\Software\Microsoft\Windows\Windows Error Reporting" | |
reg query !RegWindowsReporting!>nul 2>&1 & if %errorLevel%==0 ( | |
reg add !RegWindowsReporting! /v Disabled /t REG_DWORD /d 1 /f >nul | |
) | |
) | |
if %BlockIPaddresses%==1 ( | |
call:title "Block M$ servers IP addresses.." | |
for %%? in ( | |
"111.221.29.177" | |
"111.221.29.253" | |
"131.253.40.37" | |
"134.170.30.202" | |
"134.170.115.60" | |
"134.170.165.248" | |
"134.170.165.253" | |
"134.170.185.70" | |
"137.116.81.24" | |
"137.117.235.16" | |
"157.55.129.21" | |
"157.55.133.204" | |
"157.56.121.89" | |
"157.56.91.77" | |
"168.63.108.233" | |
"184.86.56.12" | |
"185.13.160.61" | |
"191.232.139.254" | |
"191.232.80.58" | |
"191.232.80.62" | |
"191.237.208.126" | |
"204.79.197.200" | |
"207.46.101.29" | |
"207.46.114.58" | |
"207.46.223.94" | |
"207.68.166.254" | |
"212.30.134.204" | |
"212.30.134.205" | |
"23.102.21.4" | |
"23.99.10.11" | |
"23.218.212.69" | |
"64.4.54.22" | |
"64.4.54.32" | |
"64.4.6.100" | |
"65.39.117.230" | |
"65.52.100.11" | |
"65.52.100.7" | |
"65.52.100.9" | |
"65.52.100.91" | |
"65.52.100.92" | |
"65.52.100.93" | |
"65.52.100.94" | |
"65.52.108.29" | |
"65.55.108.23" | |
"65.55.138.114" | |
"65.55.138.126" | |
"65.55.138.186" | |
"65.55.252.63" | |
"65.55.252.71" | |
"65.55.252.92" | |
"65.55.252.93" | |
"65.55.29.238" | |
"65.55.39.10" | |
) do call:block_route %%? | |
) | |
if %BlockIPaddressesWithFirewall%==1 ( | |
call:title "Add blocked IP adressess to firewall rule.." | |
rem For using this shit you must init IP addresses list by calling 'call:block_route "1.1.1.1"' first! | |
call:block_routes_with_firewall | |
) | |
if %AddDomainsToHosts%==1 ( | |
call:title "Find and add M$ domains to HOSTS file ^(block^).." | |
for %%? in ( | |
"--title--" | |
"msedge.net" | |
"a-msedge.net" | |
"a-0001.a-msedge.net" | |
"a-0002.a-msedge.net" | |
"a-0003.a-msedge.net" | |
"a-0004.a-msedge.net" | |
"a-0005.a-msedge.net" | |
"a-0006.a-msedge.net" | |
"a-0007.a-msedge.net" | |
"a-0008.a-msedge.net" | |
"a-0009.a-msedge.net" | |
"a1095.g2.akamai.net" | |
"ad.doubleclick.net" | |
"adnexus.net" | |
"adnxs.com" | |
"secure.adnxs.com" | |
"m.adnxs.com" | |
"ads1.msads.net" | |
"ads1.msn.com" | |
"ads2.msn.com" | |
"flex.msn.com" | |
"g.msn.com" | |
"h2.msn.com" | |
"h1.msn.com" | |
"a.ads1.msn.com" | |
"a.ads2.msn.com" | |
"a.ads2.msads.net" | |
"live.rads.msn.com" | |
"ads2.msn.com.c.footprint.net" | |
"aka-cdn-ns.adtech.de" | |
"az361816.vo.msecnd.net" | |
"az512334.vo.msecnd.net" | |
"bs.serving-sys.com" | |
"msntest.serving-sys.com" | |
"telemetry.microsoft.com" | |
"ca.telemetry.microsoft.com" | |
"c.msn.com" | |
"aidps.atdmt.com" | |
"view.atdmt.com" | |
"ec.atdmt.com" | |
"c.atdmt.com" | |
"db3aqu.atdmt.com" | |
"cdn.atdmt.com" | |
"choice.live.com" | |
"choice.microsoft.com" | |
"choice.microsoft.com.nsatc.net" | |
"compatexchange.cloudapp.net" | |
"corpext.msitadfs.glbdns2.microsoft.com" | |
"corp.sts.microsoft.com" | |
"cs1.wpc.v0cdn.net" | |
"df.telemetry.microsoft.com" | |
"e9946.g.akamaiedge.net" | |
"fe2.update.microsoft.com.akadns.net" | |
"fe3.delivery.dsp.mp.microsoft.com.nsatc.net" | |
"microsoft-hohm.com" | |
"feedback.microsoft-hohm.com" | |
"feedback.search.microsoft.com" | |
"feedback.windows.com" | |
"i1.services.social.microsoft.com" | |
"i1.services.social.microsoft.com.nsatc.net" | |
"i.s1.social.ms.akadns.net" | |
"lb1.www.ms.akadns.net" | |
"legacy-redirection-neurope-prod-hp.cloudapp.net" | |
"oca.telemetry.microsoft.com" | |
"oca.telemetry.microsoft.com.nsatc.net" | |
"onesettings-hk2.metron.live.com.nsatc.net" | |
"pre.footprintpredict.com" | |
"preview.msn.com" | |
"ads.msn.com" | |
"rad.msn.com" | |
"rad.live.com" | |
"b.rad.msn.com" | |
"b.ads2.msads.net" | |
"b.ads1.msn.com" | |
"ac3.msn.com" | |
"a.rad.msn.com" | |
"cds26.ams9.msecn.net" | |
"secure.flashtalking.com" | |
"static.2mdn.net" | |
"s0.2mdn.net" | |
"redirection.prod.cms.msn.com" | |
"redirection.prod.cms.msn.com.akadns.net" | |
"redir.metaservices.microsoft.com" | |
"redir.metaservices.microsoft.com.akadns.net" | |
"redir.metaservices.microsoft.com.edgesuite.net" | |
"wes.df.telemetry.microsoft.com" | |
"reports.wes.df.telemetry.microsoft.com" | |
"services.wes.df.telemetry.microsoft.com" | |
"settings.data.glbdns2.microsoft.com" | |
"settings.data.microsoft.com" | |
"settings-sandbox.data.glbdns2.microsoft.com" | |
"settings-sandbox.data.microsoft.com" | |
"settings-win.data.microsoft.com" | |
"schemas.microsoft.akadns.net" | |
"siweb.microsoft.akadns.net" | |
"sls.update.microsoft.com.akadns.net" | |
"spynet2.microsoft.akadns.net" | |
"spynet2.microsoft.com" | |
"spynetalt.microsoft.akadns.net" | |
"spynetalt.microsoft.com" | |
"spyneteurope.microsoft.akadns.net" | |
"sqm.df.telemetry.microsoft.com" | |
"sqm.telemetry.microsoft.com" | |
"sqm.telemetry.microsoft.com.nsatc.net" | |
"ssw.live.com" | |
"ssw.live.com.nsatc.net" | |
"statsfe1.ws.microsoft.com" | |
"statsfe1.ws.microsoft.com.nsatc.net" | |
"statsfe2.update.microsoft.com.akadns.net" | |
"statsfe2.ws.microsoft.com" | |
"statsfe2.ws.microsoft.com.nsatc.net" | |
"support.msn.microsoft.akadns.net" | |
"watson.microsoft.com" | |
"survey.watson.microsoft.com" | |
"telecommand.telemetry.microsoft.com" | |
"telecommand.telemetry.microsoft.com.nsatc.net" | |
"telemetry.appex.bing.net" | |
"telemetry.appex.search.prod.ms.akadns.net" | |
"telemetry.urs.microsoft.com" | |
"t.urs.microsoft.com.nsatc.net" | |
"vortex.data.glbdns2.microsoft.com" | |
"vortex.data.metron.live.com.nsatc.net" | |
"vortex-bn2.metron.live.com.nsatc.net" | |
"vortex-cy2.metron.live.com.nsatc.net" | |
"vortex.data.microsoft.com" | |
"vortex-db5.metron.live.com.nsatc.net" | |
"vortex-sandbox.data.glbdns2.microsoft.com" | |
"vortex-sandbox.data.microsoft.com" | |
"vortex-win.data.metron.live.com.nsatc.net" | |
"vortex-win.data.microsoft.com" | |
"watson.live.com" | |
"watson.microsoft.com.nsatc.net" | |
"watson.ppe.telemetry.microsoft.com" | |
"watson.telemetry.microsoft.com" | |
"watson.telemetry.microsoft.com.nsatc.net" | |
) do call:add_to_hosts %%? | |
) | |
if %DisableAutomaticUpdates%==1 ( | |
call:title "Disable automatic windows update ^(make search, but you must manually select updates to install^)" | |
set RegeditRoot="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" | |
reg add !RegeditRoot! /v AUOptions /t REG_DWORD /d 2 /f>nul | |
reg add !RegeditRoot! /v IncludeRecommendedUpdates /t REG_DWORD /d 0 /f>nul | |
) | |
goto:end | |
:log | |
set message=%~1 | |
set type=%~2 | |
if [!type!] EQU [] ( | |
set type=%time% | |
) | |
echo [!type!] %message% | |
if %WriteLogFile%==1 ( if [%LogFilePath%] NEQ [] ( | |
echo [!type!] %message%>>%LogFilePath% 2>&1 | |
)) | |
exit /b | |
:title | |
set title=%~1 | |
echo. | |
echo [i] %title% | |
if %WriteLogFile%==1 ( if [%LogFilePath%] NEQ [] ( | |
echo.>>%LogFilePath% 2>&1 | |
echo [i] %title%>>%LogFilePath% 2>&1 | |
)) | |
exit /b | |
:checkPermissions | |
if exist %SystemRoot%\System32\fsutil.exe ( | |
fsutil dirty query %systemdrive%>nul 2>&1 | |
) else ( | |
net session >nul 2>&1 | |
) | |
if %errorLevel%==0 ( | |
goto:begin | |
) else ( | |
call:log "[Failure] Need administrative permissions" | |
goto:end | |
) | |
exit /b | |
:download_file | |
set url=%~1 | |
set dest=%~2 | |
powershell -ExecutionPolicy RemoteSigned -NoLogo -Noninteractive -Command "try { Import-Module BitsTransfer; Start-BitsTransfer -Source %url% -Destination %dest%; exit 100; } catch { exit 0; }">nul | |
exit /b | |
:install_pswu_module | |
set ps_modules_dir=%windir%\System32\WindowsPowerShell\v1.0\Modules | |
set pswu_distr_path="!ps_modules_dir!\PSWindowsUpdate" | |
set result=0 | |
if exist "!pswu_distr_path!\Hide-WUUpdate.ps1" ( | |
rem call:log "PowerShell module 'PSWindowsUpdate' found" | |
set result=100 | |
) else ( | |
set local_unzip_tool=0 | |
set local_pswu_module=0 | |
call:log "Install PowerShell module 'PSWindowsUpdate'" "Install update" | |
if exist "%~dp0\unzip.exe" ( | |
set local_unzip_tool=1 | |
set unzip_tool="%~dp0\unzip.exe" | |
call:log "Local unzip tool found" | |
) else ( | |
set unzip_tool="%temp%\unzip.exe" | |
call:log "Download unzip tool.." | |
rem Original source: http://stahlworks.com/dev/unzip.exe | |
call:download_file "https://www.dropbox.com/s/gxf8d4bg0yyozdh/unzip.exe?dl=1" !unzip_tool! | |
) | |
if exist !unzip_tool! ( | |
if exist "%~dp0\PSWindowsUpdate.zip" ( | |
set local_pswu_module=1 | |
set pswu_zip="%~dp0\PSWindowsUpdate.zip" | |
call:log "Local PSWindowsUpdate module found" | |
) else ( | |
set pswu_zip="%temp%\PSWindowsUpdate.zip" | |
call:log "Download PowerShell module 'PSWindowsUpdate'.." | |
rem Original source: https://gallery.technet.microsoft.com/scriptcenter/2d191bcd-3308-4edd-9de2-88dff796b0bc/ | |
call:download_file "https://www.dropbox.com/s/z61nlkfecmhabil/PSWindowsUpdate.zip?dl=1" !pswu_zip! | |
) | |
if exist !pswu_zip! ( | |
set pswu_temp="%temp%\pswindowsupdate_content" | |
call:log "Unzip module archive.." | |
!unzip_tool! -oC !pswu_zip! -d !pswu_temp!>nul | |
if exist !pswu_temp! ( | |
call:log "Move module files to PowerShell modules directory.." | |
if exist !pswu_distr_path! (rmdir !pswu_distr_path! /s /q>nul) | |
move /y "!pswu_temp!\PSWindowsUpdate" !ps_modules_dir!>nul | |
if "!local_unzip_tool!" NEQ "1" (del /f !unzip_tool!>nul) | |
if "!local_pswu_module!" NEQ "1" (del /f !pswu_zip!>nul) | |
rmdir !pswu_temp! /s /q>nul | |
if exist "!pswu_distr_path!\Hide-WUUpdate.ps1" ( | |
call:log "'PSWindowsUpdate' module for PowerShell installed" "Installation complete" | |
set result=100 | |
timeout /t 2 /nobreak>nul & tskill powershell>nul 2>&1 & timeout /t 2 /nobreak>nul | |
) else ( | |
call:log "Installation module 'PSWindowsUpdate' failed - files in !pswu_distr_path! not found" "Installation failed" | |
) | |
) | |
) | |
) | |
) | |
exit /b | |
:uninstall_update | |
set kb_id=%~1 | |
rem Remove update | |
call:log "Uninstall update KB%kb_id%.." | |
start /wait wusa /uninstall /norestart /quiet /kb:%kb_id% | |
if %errorlevel%==2359303 call:log "Update KB%kb_id% not installed" | |
if %errorlevel%==1223 call:log "Uninstall cancelled" | |
if %errorlevel%==3010 call:log "Update KB%kb_id% UNINSTALLED successfully" | |
rem Add all updates IDs to single string variable (',' is delimiter) | |
set UpdatesList=%UpdatesList%KB%kb_id%, | |
exit /b | |
:disable_updates | |
rem Add update to Windows Update exceptions (hide update) using PowerShell | |
if [!UpdatesList!] EQU [] ( | |
call:log "Empty updates list. For add update ID to block list - uninstall update by script before" "Error" | |
exit /b | |
) | |
rem Remove last (',') char | |
set UpdatesListForDisabling=!UpdatesList:~0,-1! | |
call:install_pswu_module | |
if %result%==100 ( | |
call:log "Disable updates: !UpdatesListForDisabling!.." | |
powershell -ExecutionPolicy RemoteSigned -NoLogo -Noninteractive -Command "Import-Module PSWindowsUpdate; try { Hide-WUUpdate -KBArticleID !UpdatesListForDisabling! -Confirm:$false; exit 100; } catch { exit 0; }">nul 2>&1 | |
if !errorlevel!==100 ( | |
call:log "Updates successfully DISABLED" | |
) else ( | |
call:log "Cannot disable updates: Update your PowerShell or install PowerShell module 'PSWindowsUpdate'" "Error" | |
) | |
) | |
exit /b | |
:block_route | |
set REDIRECT=0.0.0.0 | |
set ip_addr=%~1 | |
call:log "Block route to %ip_addr%" | |
route -p ADD %ip_addr% MASK 255.255.255.255 %REDIRECT%>nul 2>&1 | |
rem Add all addresses to single string variable (',' is delimiter) | |
set FirewallIPlist=%FirewallIPlist%%ip_addr%, | |
exit /b | |
:block_routes_with_firewall | |
if [!FirewallIPlist!] EQU [] ( | |
call:log "Empty IP list. For add IP to firewall block list - block ip by route first" "Error" | |
exit /b | |
) | |
if exist %SystemRoot%\System32\netsh.exe ( | |
set FirewallRuleName=Block MS Telemetry | |
rem Remove exists rule + add new rule + make exists check | |
netsh advfirewall firewall delete rule name="!FirewallRuleName!">nul | |
netsh advfirewall firewall add rule name="!FirewallRuleName!" dir=out action=block remoteip=!FirewallIPlist! interfacetype=any>nul | |
netsh advfirewall firewall show rule name="!FirewallRuleName!">nul | |
if %errorlevel% EQU 0 ( | |
call:log "IP adresses blocked with firewall rule '!FirewallRuleName!': '!FirewallIPlist:~0,-1!'" | |
) else ( | |
call:log "Cannot add firewall rule '!FirewallRuleName!' - maybe firewall servise disabled^?" "Error" | |
) | |
) else ( | |
call:log "Windows firewall not accessible (file 'netsh.exe' not exists)" "Error" | |
) | |
exit /b | |
:disable_task | |
set task_name=%~1 | |
call:log "Disable task %task_name%" | |
schtasks /Change /TN "%task_name%" /DISABLE>nul 2>&1 | |
exit /b | |
:disable_service | |
set service_name=%~1 | |
set errors_counter=0 | |
call:log "Disable service '%service_name%'" | |
sc query "%service_name%">nul | |
if %errorlevel% NEQ 1060 ( | |
sc config "!service_name!" start= disabled>nul | |
if %errorlevel% NEQ 0 set /a errors_counter=errors_counter+1 | |
sc stop "!service_name!">nul | |
if %errorlevel% NEQ 0 set /a errors_counter=errors_counter+1 | |
if %errors_counter%==0 ( | |
call:log "Service '!service_name!' disabled successful" | |
) | |
) else set /a errors_counter=errors_counter+1 & call:log "Service '!service_name!' not installed" | |
exit /b | |
:add_to_hosts | |
set HOSTS=%SystemRoot%\system32\drivers\etc\hosts | |
set REDIRECT=0.0.0.0 | |
set block_title=## Block MS telemetry domain names | |
set write_title=0 | |
set host_name=%~1 | |
if "%host_name%"=="--title--" ( | |
set write_title=1 | |
set host_name=%block_title% | |
) | |
find /C /I "%host_name%" %HOSTS%>nul | |
if %errorlevel% NEQ 0 ( | |
attrib -r %HOSTS%>nul | |
if !write_title! EQU 1 ( | |
echo.>>%HOSTS% | |
echo.>>%HOSTS% | |
echo %block_title%>>%HOSTS% | |
) else ( | |
echo %REDIRECT% %host_name%>>%HOSTS% | |
call:log "Domain %host_name% ADDED" | |
) | |
) else ( | |
if !write_title! NEQ 1 ( | |
call:log "Domain %host_name% ALREADY added" | |
) | |
) | |
exit /b | |
:end | |
call:title "Exit after 60 seconds, or press any key for exit now" | |
timeout /t 60>nul 2>&1 | |
endlocal & if %ExitOnComplete%==1 (exit) | |
echo on |
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
Perhaps it is well worth adding: |
This comment has been minimized.
This comment has been minimized.
No, f*ck, no, you dont need disable remote registry |
This comment has been minimized.
This comment has been minimized.
2 questions : |
This comment has been minimized.
This comment has been minimized.
Script fails on Windows 7 Home Basic with PowerShell 1.0 installed (no module PSWindowsUpdate).
|
This comment has been minimized.
This comment has been minimized.
@AvgurD Thanks! Same issue on Win7 Ultimate SP1 (I've installed it into user's home dir instead). |
This comment has been minimized.
This comment has been minimized.
To @thunderpants: |
This comment has been minimized.
This comment has been minimized.
To @AvgurD: |
This comment has been minimized.
This comment has been minimized.
To @powerman: |
This comment has been minimized.
This comment has been minimized.
Привет ковырялся с 10-ткой дополнительно список потенциально опасных тасков, конечно нужно посмотреть, но имхо полезного от них точно ничего:
крайний таск BackgroundUploadTask что называется на буржуйском tricky - нужно сначала дать с помощью setacl права на ветки реестра, потом поменять в ветке triggers значение (там два байта) и потом уже заблокировать таск... можно еще с помощью psexec запустить сразу от имени system и заблокировать - этот вариант не пробовал но люди говорят что работает |
This comment has been minimized.
This comment has been minimized.
Приветствую, оказывается сайт diagnostics.support.microsoft.com используется для загрузки утилит FixIt, наверное нужно его убрать из списка хостов для блокировки. |
This comment has been minimized.
This comment has been minimized.
Приветствую. Увидел новую версию скрипта, а почему не обратили внимание на мой комментарий по поводу сайта diagnostics.support.microsoft.com? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Приветствую, похоже в блоге комментарии более не поддерживаются :-) |
This comment has been minimized.
This comment has been minimized.
You should include latest new recommended update of https://support.microsoft.com/en-us/kb/3112336 'KB3112336' to the list of removal from the upgrade. "This update enables support for additional upgrade scenarios from Windows 8.1 to Windows 10, and provides a smoother experience when you have to retry an operating system upgrade because of certain failure conditions. This update also improves the ability of Microsoft to monitor the quality of the upgrade experience." |
This comment has been minimized.
This comment has been minimized.
Приветствую! К комменту выше, хочу добавить. KB3112343 - https://support.microsoft.com/en-us/kb/3112343 - Windows Update Client for Windows 7 and Windows Server 2008 R2: December 2015 |
This comment has been minimized.
This comment has been minimized.
Из-за блокировки этих хостов - в конференциях скайпа не показываются участники и вообще они начинают сильно глючить. |
This comment has been minimized.
This comment has been minimized.
Thanks for your last update. MS has added few new updates that you should add them to the blacklist.
This update applies to Windows 8.1 or Windows 7 Service Pack 1 (SP1). Before you install this update, check out the Prerequisites section."
|
This comment has been minimized.
This comment has been minimized.
Точнее вот: |
This comment has been minimized.
This comment has been minimized.
-KB2952664-v16 02.02.16 Обновление для Windows 7 (для перехода на Windows 10) |
This comment has been minimized.
This comment has been minimized.
2 @yura-p - |
This comment has been minimized.
This comment has been minimized.
KB3139929 тоже гадость, причем пополам с полезностью :( |
This comment has been minimized.
This comment has been minimized.
Oddly enough, this script still does not disable optional updates for KB2976978, KB3035583, and KB3068708. For me, this is what made by confused me on the last comment. I cannot reproduce this issue, however, it seems that only those three are appearing on the Windows Update after running your script and restarting the computer. I will update this as soon as I find out the cause. By the way, for some odd reasons, the KB3035583 and KB3068708 has changed or updated the release date, something to keep in mind. |
This comment has been minimized.
This comment has been minimized.
Добавьте 3133977, он ломает материнки: |
This comment has been minimized.
This comment has been minimized.
Please blacklist latest telemetry update: KB2976978 (Compatibility update for Windows 8.1 and Windows 8). Thank you, |
This comment has been minimized.
This comment has been minimized.
what is about this one? https://support.microsoft.com/en-us/kb/3161608 It contains: KB3161647 Windows Update Client for Windows 7 and Windows Server 2008 R2: June 2016 |
This comment has been minimized.
This comment has been minimized.
Ребят, спасибо за то что вы тут делаете |
This comment has been minimized.
This comment has been minimized.
Office 2016 telemetry block:
|
This comment has been minimized.
This comment has been minimized.
Скрипт мной более не поддерживается. Обновлений ждать нет смысла. Всем мурThe script is longer supported. Updates will not be. Meow, blyat |
This comment has been minimized.
This comment has been minimized.
I've added new updates to the script, and fixed some typos here and there. I intend to support this script further on behalf of tarampampam. https://github.com/simdol/Remove-MS-Telemetry-and-Annoyances @tarampampam: Thanks for your script and continued support until now. Your script has been excellent solution for many users here, and I would like to thank everyone else who contributed to this script as well. |
This comment has been minimized.
This comment has been minimized.
Здравия, Благодарю за скрипт. Подскажите пожалуйста, как бороться с проблемой загрузки рабочего стола после авторизации пользователя. Метод смены пользователя на вновь созданного не помогает, а система все дольше открывает рабочий стол после авторизации видового юзера, просто смысл SSD диска пропадает под систему. Появляется мышь на черном экране и так приходится ждать минуту или две, пока откликнутся первые проблески explorer. Благодарю! |
This comment has been minimized.
Change "exit /b" to "goto :EOF", this won't force close terminal window if script is executed from command line rather than explorer.