Disable shutdown tracker (VBScript)

This code can be found in Chapter 2 of Windows Server Cookbook

Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.

Find out how to download all of the VBScript code from this site.

' This code disables the Shutdown Tracker from running.
' ---------------------------------------------------------------
' From the book "Windows Server Cookbook" by Robbie Allen
' ISBN: 0-596-00633-0
' ---------------------------------------------------------------

' ------ SCRIPT CONFIGURATION ------
intEnable = 0      ' 0 = disable; 1 = enable screen
strComputer = "."  ' e.g. rallen-srv01
' ------ END CONFIGURATION ---------
const HKLM = &H80000002
strKeyPath = "SOFTWARE\Policies\Microsoft\Windows NT\Reliability"
set objReg = GetObject("winmgmts:\\" & strComputer & _
                       "\root\default:StdRegProv")
intRC1 = objReg.CreateKey(HKLM,strKeyPath)
intRC2 = objReg.SetDwordValue(HKLM, strKeyPath, "ShutdownReasonOn", intEnable)
if intRC1 <> 0 or intRC2 <> 0 then
   WScript.Echo "Error setting registry value: " & intRC
else
   WScript.Echo "Successfully disabled shutdown tracker"
end if

This code has been viewed 1298 times.

New from the creators of TechTasks.com: StatSheet.com