Windows – Enable Remote Assistance and Add Firewall Exception via Command Line

command linefirewallremote-assistancewindowswindows 8.1

I need to enable Remote Assistance from the command line. The equivalent of checking this box and hitting Apply.

enter image description here

This is for automation and I tried editing the registry entry HKLM\System\CurrentControlSet\Control\Remote Assistance\fAllowToGetHelp but the troubleshooter comes up and needs it to allow it through the firewall.

This page says how to allow ports through the firewall, but not how to add applications, and I see here that the firewall settings vary depending on the network type. How can I automate this like the check box, which just figures everything out automatically?

When the message comes up saying This computer is not set up for invitations, I can click Repair. When I do this, the troubleshooter automatically fixes everything, but it is visible and requires me to close it manually when it's finished. It's msdt.exe, but I'm not sure how to use it from the command line. I used Process Explorer to see what msra.exe was doing, but the answer file (which tells the troubleshooter what answers to use for questions it asks) it passed to the troubleshooter was deleted by the time I tried to open it. Also, I need the msdt.exe to automatically close.

I've been searching for hours but could not find anything helpful.

Best Answer

To allow remote assistance in firewall:
netsh advfirewall firewall set rule group="remote assistance" new enable=Yes

For adding/editing a registry key:
reg add "HKLM\System\CurrentControlSet\Control\Remote Assistance" /v fAllowToGetHelp /t REG_DWORD /d 1 /f

Related Question