Search code examples
remote-debugging

Way to configure VS remote debugger via cmd


I want to deploy Visual Studio Remote Debugger to the target machines automatically. I can install Remote Debugger silently via cmd, grant required prevelegues to user and modify firewall. I have to configure it using Wizard (rdbgwiz.exe) and it seems the Wizard doesn't have command line parameters. How I can configure Remote Debugger? Is there a way to do it without the Wizard? What Wizard does? Just only creates a service?


Solution

  • It is not neccesary to run Wizard. You could do the following:
    1) Disable Windows Firewall completely. Unfortunately, partially fix as allowing connections for required ports doesn't work.
    2) Install debugger, use /q option to silent install
    3) Allow your account to Log on as a Service.
    4) Change log on credentials for Remote Debugger service.
    5) Enable debugger service.
    6) Run it. *
    So, my bat file looks like

    @echo off
    
    pushd %~dp0
    
    netsh advfirewall set domain state off
    netsh advfirewall set private state off
    netsh advfirewall set public state off
    
    if "%PROCESSOR_ARCHITECTURE%"=="x86" (
      set arch=x86
    ) else (
      set arch=x64
    )
    
    "rtools_setup_%arch%.exe" /q
    
    ntrights.exe -u %username% +r SeServiceLogonRight
    
    sc config msvsmon120  obj= "%computername%\%username%" password= "password"
    sc config msvsmon120 start= auto
    sc start msvsmon120
    

    *) Be careful about debugger version. Different versions of debugger have different service names: msvsmon100 is for VS 2010 debugger, msvsmon110 for 2012 and msvsmon120 for 2013.