Configuring System Failure Options

Microsoft operating systems have had a reputation for frequent crashes, which can cause the system to freeze and become unusable until it is rebooted. A crash is sometimes referred to as a system failure, bug check, stop error, or blue screen of death (for the blue screen that is displayed after the crash). System failures were especially common in the days of Windows 3.51 and Windows 9x. Fortunately, Microsoft has steadily improved in this area and now Windows 2000 and Windows Server 2003 are two of the most stable operating systems available. Nevertheless, Microsoft hasn’t been able to completely rid itself of occasional crashes due to bugs in the OS or bad third-party drivers.

There are several settings you can configure to control what happens after a system crash. By default, when a system crashes, it writes the contents of memory to a debug file in the system root called memory.dmp. This file will be one of the first things Microsoft asks for if you open a support case about the crash (see MS KB 314103 for more information). After the debug file is written, an event is written to the System Event log and, if configured, an administrative alert is sent to the administrator of the system. See MS KB 310490 for more on configuring administrative alerts. Lastly, the system automatically reboots. You may want to give some thought about this last option because I’ve seen more than one case where a system continuously reboots itself because it experienced the failure during system startup. Also, if you automatically reboot and are not closely monitoring your systems, there could be sporadic undetected crashes.

Using a graphical user interface

  1. From the Control Panel, open the System applet.
  2. Select the Advanced tab.
  3. Under Startup and Recovery, click the Settings button.
  4. All of the system failure options are located under the System Failure heading. Modify the settings as necessary.
  5. Click OK until all of the windows are closed.

Using a command-line interface

The system failure and recovery options are stored in the registry. You can view the current settings by enumerating the HKLM\SYSTEM\CurrentControlSet\Control\CrashControl subkey:

> reg query \\\HKLM\SYSTEM\CurrentControlSet\Control\CrashControl

On Windows Server 2003, you can also use the wmic utility to view these settings:

> wmic /node: recoveros list /format:list

To modify these settings, use either the reg add command (on Windows 2000) or the wmic command (on Windows Server 2003). Next, I’ll show some examples using wmic.

To disable admin alerts after failure, do the following:

> wmic recoveros set SendAdminAlert = False

To disable automatic reboot after failure, do the following:

> wmic recoveros set AutoReboot = False

To not write any information to a memory dump file after failure, do the following:

> wmic recoveros set DebugInfoType = 0

To set the mini-dump directory to d:\minidumps (only available with Windows Server 2003), do the following:

> wmic recoveros set MiniDumpDirectory = d:\minidumps

To set the location of the dump file to D:\Dump\Mem.dmp, do the following:

> wmic recoveros set DebugFilePath = D:\Dump\Mem.dmp

To not overwrite an existing dump file, do the following:

> wmic recoveros set OverwriteExistingDebugFile = 0

Using VBScript

' This code displays the current failure and recovery settings.
 ' ------ SCRIPT CONFIGURATION ------
 strComputer = "."  ' e.g., rallen-srv01
 ' ------ END CONFIGURATION ---------
 set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
 set colRecoveryConfig = objWMI.InstancesOf("Win32_OSRecoveryConfiguration")
 for each objConfig in colRecoveryConfig
     Wscript.Echo objConfig.Name
     Wscript.Echo "  Auto reboot: " & objConfig.AutoReboot
     Wscript.Echo "  Debug File Path: " & objConfig.DebugFilePath
     Wscript.Echo "  Debug Type: " & objConfig.DebugInfoType
     Wscript.Echo "  Expanded Debug File Path: " & objConfig.ExpandedDebugFilePath
     Wscript.Echo "  Kernel Dump Only: " & objConfig.KernelDumpOnly
     Wscript.Echo "  Overwrite Existing: " & objConfig.OverwriteExistingDebugFile
     Wscript.Echo "  Send Admin Alert: " & objConfig.SendAdminAlert
     Wscript.Echo "  Write Debug Info: " & objConfig.WriteDebugInfo
     Wscript.Echo "  Write to System Log: " & objConfig.WriteToSystemLog
 next
' This code modifies the system failure and recovery settings.
 ' ------ SCRIPT CONFIGURATION ------
 strComputer = "."  ' e.g., rallen-srv01
 ' ------ END CONFIGURATION ---------
 set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
 set colRecoveryConfig = objWMI.InstancesOf("Win32_OSRecoveryConfiguration")
 for each objConfig in colRecoveryConfig
     Wscript.Echo objConfig.Name
   ' Uncomment the settings you want to modify:
     ' objConfig.AutoReboot = True
     ' objConfig.DebugFilePath = "d:\dumps\memory.dmp"
     ' objConfig.DebugInfoType = 1  ' Only available on W2K3
     ' objConfig.KernelDumpOnly = False
     ' objConfig.MiniDumpDirectory = "d:\minidumps" ' Only available on W2K3
     ' objConfig.OverwriteExistingDebugFile = True
     ' objConfig.SendAdminAlert = True
     ' objConfig.WriteDebugInfo = True
     ' objConfig.WriteToSystemLog = True
    objConfig.Put_
 next
 WScript.Echo "Successfully modified settings."