Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.3 KiB

  1. @echo on
  2. @rem
  3. setlocal
  4. if "%1"=="" goto :Usage
  5. set MACHINE=%1
  6. set STATUSFILE=\\%MACHINE%\BC_DISTSTATUS\%COMPUTERNAME%.txt
  7. echo Started RegisterMTScript.cmd > %STATUSFILE%
  8. for /f %%x in ('hostname') do set myname=%%x
  9. net share BC_BUILD_LOGS /delete /y
  10. net share BC_BUILD_LOGS=%TEMP% /GRANT:ntdev\ntbuild,full /Remark:"Build Console build logs share"
  11. if errorlevel 1 (call :RegError Error creating BC_BUILD_LOGS share & goto :PauseBeforeExit)
  12. if exist MTRCopy.dll (
  13. regsvr32 /s MTRCopy.dll || (call :RegError Error registering MTRCopy.dll & goto :PauseBeforeExit)
  14. ) else (
  15. regsvr32 /s RCopy.dll || (call :RegError Error registering RCopy.dll & goto :PauseBeforeExit)
  16. )
  17. regsvr32 /s mtscrprx.dll || (call :RegError Error registering mtscrprx.dll & goto :PauseBeforeExit)
  18. regsvr32 /s mtlocal.dll || (call :RegError Error registering mtlocal.dll & goto :PauseBeforeExit)
  19. regsvr32 /s mtodproxy.dll || (call :RegError Error registering mtodproxy.dll & goto :PauseBeforeExit)
  20. @Rem Unregister first to reset security information
  21. mtscript.exe /unregister
  22. mtscript.exe /register
  23. if ERRORLEVEL 1 (call :RegError Error registering mtscript.exe & goto :PauseBeforeExit)
  24. @Rem Unregister first to reset security information
  25. mtodaemon.exe /unregister
  26. mtodaemon.exe /register
  27. if ERRORLEVEL 1 (call :RegError Error registering mtodaemon.exe & goto :PauseBeforeExit)
  28. @rem This process was started CreateProcessWithLogonW (from bsrunas.exe). This
  29. @rem means that we are in a job object. This interferes with mtscript's job
  30. @rem management. Thus, we will rely on automatic launching to get mtscript going.
  31. @rem start mtscript.exe
  32. @rem if ERRORLEVEL 1 (call :RegError mtscript.exe & goto :PauseBeforeExit)
  33. echo OK> %STATUSFILE%
  34. goto :PauseBeforeExit
  35. :RegError
  36. @echo ==============================================
  37. @echo FAILED RegisterMTScript.cmd: %* > %STATUSFILE%
  38. net send %MACHINE% %* on host %myname%
  39. goto :PauseBeforeExit
  40. :Usage
  41. @echo.
  42. @echo.
  43. @echo ===================================================
  44. @echo Usage: registermtscript.cmd NotifyMachine directory
  45. @goto :PauseBeforeExit
  46. :PauseBeforeExit
  47. @echo.
  48. @echo.
  49. @echo This window will close 30 minutes after %DATE% %TIME%
  50. @echo Presss Ctrl-BREAK to prevent this
  51. Sleep 1800
  52. if ERRORLEVEL 1 goto :EOF
  53. exit 1
  54. goto :EOF