trace_on.cmd 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. @echo off
  2. chcp 866
  3. echo Debug trace on utility
  4. echo Set kernel drivers debug output parameters
  5. reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Debug Print Filter" /v DEFAULT /t REG_DWORD /d 0xffffffff /f
  6. IF errorlevel 1 GOTO :error
  7. echo.
  8. echo Set debug trace parameters
  9. reg add "HKLM\SYSTEM\CurrentControlSet\Services\sncc0\Trace" /v EnableMask /t REG_DWORD /d 0x000f /f
  10. IF errorlevel 1 GOTO :error
  11. reg add "HKLM\SYSTEM\CurrentControlSet\Services\sncc0\Trace" /v ParamsMask /t REG_DWORD /d 0xbd09 /f
  12. IF errorlevel 1 GOTO :error
  13. reg add "HKLM\SYSTEM\CurrentControlSet\Services\sncc0\Trace" /v CommonFileFlag /t REG_DWORD /d 0x0001 /f
  14. IF errorlevel 1 GOTO :error
  15. reg add "HKLM\SYSTEM\CurrentControlSet\Services\sncc0\Trace" /v DisableContextFlag /t REG_DWORD /d 0x0000 /f
  16. IF errorlevel 1 GOTO :error
  17. reg add "HKLM\SYSTEM\CurrentControlSet\Services\sncc0\Trace" /v TracePath /t REG_SZ /d "C:\Logs" /f
  18. IF errorlevel 1 GOTO :error
  19. echo.
  20. echo Create C:\Logs debug log directory
  21. IF NOT EXIST C:\Logs mkdir C:\Logs
  22. echo.
  23. rem The result of the rights installation is not checked. The error is noncritical.
  24. echo Set security on C:\Logs directory
  25. IF EXIST %SystemRoot%\System32\icacls.exe (
  26. icacls C:\Logs /grant:r "*S-1-1-0:(OI)F"
  27. icacls C:\Logs /grant "*S-1-15-2-1:(OI)F"
  28. ) ELSE (
  29. cacls C:\Logs /E /G Everyone:F
  30. )
  31. echo.
  32. echo Trace is turned on, computer should be restarted
  33. echo Restart computer right now (Y/N)?
  34. set /p answer=""
  35. IF /I %answer% EQU Y shutdown /r
  36. EXIT 0
  37. :error
  38. echo An error occured. Run command as administrator.
  39. pause
  40. EXIT 1