Skip to content

Instantly share code, notes, and snippets.

@asheroto
Last active June 7, 2021 10:03
Show Gist options
  • Save asheroto/eab64fcdabe60299bde3d672d6d19bd6 to your computer and use it in GitHub Desktop.
Save asheroto/eab64fcdabe60299bde3d672d6d19bd6 to your computer and use it in GitHub Desktop.
Disables Visual Studio 2019 Telemetry
@echo off
:: Confirm running as administrator
fltmc >nul 2>&1 || (
echo This batch script requires administrator privileges. Right-click on
echo the script and select "Run as Administrator".
goto :die
)
:: Change this path if you are using Community or Professional editions
set "VS_INSTALL_DIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise"
if not defined ProgramFiles(x86) (
set "VS_INSTALL_DIR=%ProgramFiles%\Microsoft Visual Studio\2019\Enterprise"
)
set "VS_POLICIES_KEY=HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\VisualStudio"
set "VS_POLICIES_FEEDBACK_KEY=%VS_POLICIES_KEY%\Feedback"
set "VS_POLICIES_SQM_KEY=%VS_POLICIES_KEY%\SQM"
set "VS_TELEMETRY_KEY=HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\Telemetry"
:: Disable feedback in Visual Studio
reg add "%VS_POLICIES_FEEDBACK_KEY%" /v DisableFeedbackDialog /t REG_DWORD /d 1 /f
reg add "%VS_POLICIES_FEEDBACK_KEY%" /v DisableEmailInput /t REG_DWORD /d 1 /f
reg add "%VS_POLICIES_FEEDBACK_KEY%" /v DisableScreenshotCapture /t REG_DWORD /d 1 /f
:: Disable PerfWatson
reg add "%VS_POLICIES_SQM_KEY%" /v OptIn /t REG_DWORD /d 0 /f
:: Disable telemetry
reg add "%VS_TELEMETRY_KEY%" /v TurnOffSwitch /t REG_DWORD /d 1 /f
:: Also considering adding these hostnames to your C:\Windows\system32\drivers\etc\hosts
:: - vortex.data.microsoft.com
:: - dc.services.visualstudio.com
:: - visualstudio-devdiv-c2s.msedge.net
:: - az667904.vo.msecnd.net
:: - az700632.vo.msecnd.net
:: - sxpdata.microsoft.com
:: - sxp.microsoft.com
:: Delete telemetry directories
rmdir /s /q "%AppData%\vstelemetry" 2>nul
rmdir /s /q "%LocalAppData%\Microsoft\VSApplicationInsights" 2>nul
rmdir /s /q "%ProgramData%\Microsoft\VSApplicationInsights" 2>nul
rmdir /s /q "%Temp%\Microsoft\VSApplicationInsights" 2>nul
rmdir /s /q "%Temp%\VSFaultInfo" 2>nul
rmdir /s /q "%Temp%\VSFeedbackIntelliCodeLogs" 2>nul
rmdir /s /q "%Temp%\VSFeedbackPerfWatsonData" 2>nul
rmdir /s /q "%Temp%\VSFeedbackVSRTCLogs" 2>nul
rmdir /s /q "%Temp%\VSremoteControl" 2>nul
rmdir /s /q "%Temp%\VSTelem" 2>nul
rmdir /s /q "%Temp%\VSTelem.Out" 2>nul
:: For a noticable improvement in responsiveness, I also recommend disabling any
:: of the default extensions you don't actually use, for example I disabled:
:: - VS Live Share
:: - Dotnet Extensions for Test Explorer
:: - Microsoft Studio Test Platform
:: - Test Adapter for Google Tests
:: - Test Adapter for Boost.Test
:die
echo.
pause
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment