To enable the RDP service on Port 3389 in Windows XP, you could run these commands in a script:

netsh firewall add portopening TCP 3389 RDP enable all

reg add 'hklm\system\currentcontrolset\control\terminal server' /f /v fDenyTSConnections /t REG_DWORD /d 0

reg add 'hklm\system\currentcontrolset\control\terminal server' /f /v fAllowToGetHelp /t REG_DWORD /d 0

NET STOP TermService

NET START TermService