legacy.install.bat 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. @echo off
  2. setlocal EnableDelayedExpansion
  3. echo RDP Wrapper Library Installer v1.0
  4. echo Copyright (C) Stas'M Corp. 2013
  5. echo.
  6. set PROCESSOR_ARCHITECTURE | find "x86" > nul
  7. if !errorlevel!==0 (
  8. goto WOW64CHK
  9. ) else (
  10. goto UNSUPPORTED
  11. )
  12. :WOW64CHK
  13. echo [*] Check if running WOW64 subsystem...
  14. set PROCESSOR_ARCHITEW6432 > nul
  15. if !errorlevel!==0 (
  16. goto UNSUPPORTED
  17. ) else (
  18. goto SUPPORTED
  19. )
  20. :SUPPORTED
  21. echo [+] Processor architecture is Intel x86 [supported]
  22. goto INSTALL
  23. :UNSUPPORTED
  24. echo [-] Unsupported processor architecture
  25. goto END
  26. :INSTALL
  27. echo [*] Installing...
  28. if not exist rdpwrap.dll (
  29. echo [-] Error: rdpwrap.dll file not found
  30. goto END
  31. )
  32. echo [*] Copying file to Program Files...
  33. md "%ProgramFiles%\RDP Wrapper"
  34. xcopy /y rdpwrap.dll "%ProgramFiles%\RDP Wrapper\"
  35. if not !errorlevel!==0 (
  36. echo [-] Failed to copy rdpwrap.dll to Program Files folder
  37. goto END
  38. )
  39. echo [*] Modifying registry...
  40. reg add "HKLM\SYSTEM\CurrentControlSet\Services\TermService\Parameters" /v ServiceDll /t REG_EXPAND_SZ /d "%ProgramFiles%\RDP Wrapper\rdpwrap.dll" /f
  41. if not !errorlevel!==0 (
  42. echo [-] Failed to modify registry
  43. goto END
  44. )
  45. echo [*] Setting firewall configuration...
  46. reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
  47. netsh advfirewall firewall add rule name="Remote Desktop" dir=in protocol=tcp localport=3389 profile=any action=allow
  48. netsh advfirewall firewall add rule name="Remote Desktop" dir=in protocol=udp localport=3389 profile=any action=allow
  49. echo [*] Looking for TermService PID...
  50. tasklist /SVC /FI "SERVICES eq TermService" | find "PID" /V
  51. echo.
  52. if !errorlevel!==0 (
  53. goto DONE
  54. ) else (
  55. goto SVCSTART
  56. )
  57. :SVCSTART
  58. echo [*] TermService is stopped. Starting it...
  59. sc config TermService start= auto | find "1060" > nul
  60. if !errorlevel!==0 (
  61. echo [-] TermService is not installed. You need to install it manually.
  62. goto END
  63. ) else (
  64. net start TermService
  65. goto DONE
  66. )
  67. :DONE
  68. echo [+] Installation complete!
  69. echo Now reboot or restart service.
  70. echo.
  71. echo To reboot computer type:
  72. echo shutdown /r
  73. echo.
  74. echo To restart TermService type:
  75. echo taskkill /f /pid 1234 ^(replace 1234 with real PID which is shown above^)
  76. echo net start TermService
  77. echo.
  78. echo If second method is used, and there are another services sharing svchost.exe,
  79. echo you must start it too:
  80. echo net start Service1
  81. echo net start Service2
  82. echo etc.
  83. goto END
  84. :END