Guest User

Enable Remote Desktop on Windows 7 via batch file

a guest
Feb 17th, 2014
652
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. @echo off
  2.  
  3. :: ========================================================================
  4. :: Enable Remote Desktop on Windows 7 via batch file
  5. :: - runs locally
  6. :: - remote is probably only work for domain PCs because of windows firewall
  7. :: - to run remotely: copy file to remote computer via smb
  8. :: use PSEXEC to connect to the remote computer and run batch
  9. :: - once run remote desktop will be accessible via domain name
  10. :: ie: [machineName].{domain}.{suffix}
  11. :: ========================================================================
  12.  
  13. echo disable firewall
  14. netsh advfirewall set currentprofile state off
  15.  
  16. echo add firewall rule for RD
  17. netsh advfirewall firewall set rule group=”remote desktop” new enable=Yes
  18.  
  19. echo auto start remote registry
  20. sc config RemoteRegistry start= auto
  21.  
  22. echo start remote registry
  23. net start RemoteRegistry
  24.  
  25. echo force accept of RD connections
  26. reg add "HKLM\system\currentcontrolset\control\terminal server" /v "fDenyTSConnections" /t REG_DWORD /d 0x0
  27.  
  28. echo make RD autostart
  29. sc config TermService start= auto
  30.  
  31. echo make RD umRdp auto start
  32. sc config UmRdpService start= auto
  33.  
  34. echo stop umrdp
  35. net stop UmRdpService
  36.  
  37. echo stop and restart terminal service
  38. net stop TermService&net start TermService
  39.  
  40. echo turn on firewall
  41. netsh advfirewall set currentprofile state on
  42.  
  43. :: remove REM if you want to see what happens running locally
  44. REM pause
Advertisement
Add Comment
Please, Sign In to add comment