Recipe 2.15. Configuring System Failure OptionsProblemYou want to configure what happens when a server encounters a critical failure and crashes. SolutionUsing a graphical user interface
Using a command-line interfaceThe 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 \\<ServerName>\HKLM\SYSTEM\CurrentControlSet\Control\CrashControl On Windows Server 2003, you can also use the wmic utility to view these settings: > wmic /node:<ServerName> 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." DiscussionMicrosoft 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. Table 2-3 lists all of the system failure options and their corresponding graphical, registry, WMIC, and WMI settings.
See AlsoMS KB 307973 (HOW TO: Configure System Failure and Recovery Options in Windows), MS KB 310490 (HOW TO: Set Up Administrative Alerts in Windows XP), and MS KB 314103 (Preparation Before You Contact Microsoft After Receiving a STOP Message on a Blue Screen) |