How to Allow Windows Remote Desktop remotely through command line
How to modify firewall rules remotely command line Windows 7
How to allow Remote Desktop remotely through command line
Download psexec
https://docs.microsoft.com/en-us/sysinternals/downloads/psexec
Extract to al temp place.
Make sure you are able to access remote computer NetBIOS name i.e \\RemoteComputerName without getting an error message
On your local computer, from command line and from the the temp directory that has psexec, type
psexec \\RemoteComputerName netsh advfirewall firewall set rule group=”remote desktop” new enable=Yes
For Windows 10
psexec \\RemoteComputerName netsh firewall set service type = remotedesktop mode = enable