For 10:
netsh advfirewall firewall set rule group="remote desktop" new enable=yes reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
For 7:
netsh firewall Set service REMOTEDESKTOP ENABLE netsh firewall set service REMOTEAdmin ENABLE REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0
For XP:
netsh firewall set service remotedesktop enable netsh firewall set service remoteadmin enable reg ADD "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0