Enumerating Computer Recovery Options

Microsoft® Windows® 2000 Scripting Guide

Although system administrators often overlook the recovery options, this information can be extremely useful when developing a computer management plan for your organization. For example, the recovery options let you know which troubleshooting aids (such as a debug file) will be available if the computer encounters a stop error. Likewise, these options tell you whether a computer will automatically restart during a recovery operation; if it does not, you will have to manually restart it if problems occur. Knowing how these options are configured can also help you estimate how long the recovery process takes and give you a better idea of how long it will be before a given computer will be available if it encounters an unrecoverable error.

Note

  • The actual time required to create a memory dump file depends on several factors, including the amount of memory installed on a computer and the type of dump file being created. At least, however, you know that it will take much longer to write a complete memory dump file than it will to write a small memory dump file.

You can use the Win32_OSRecoveryConfiguration class to enumerate the recovery options for a computer.

Scripting Steps

Listing 8.21 contains a script that enumerates the recovery configuration options for a computer. To carry out this task, the script must perform the following steps:

  1. Create a variable to specify the computer name.

  2. Use a GetObject call to connect to the WMI namespace root\cimv2, and set the impersonation level to "impersonate."

  3. Use the ExecQuery method to query the Win32_OSRecoveryConfiguration class.

    This query returns a collection consisting of the operating system recovery operation settings for the computer.

  4. For each set of recovery options in the collection, echo the specified property value.

Listing 8.21 Enumerating the Recovery Configuration Options for a Computer

  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
 & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colRecoveryOptions = objWMIService.ExecQuery _
 ("SELECT * FROM Win32_OSRecoveryConfiguration")
For Each objOption in colRecoveryOptions
 Wscript.Echo "Auto reboot: " & objOption.AutoReboot
 Wscript.Echo "Debug File Path: " & objOption.DebugFilePath
 Wscript.Echo "Kernel Dump Only: " & objOption.KernelDumpOnly
 Wscript.Echo "Name: " & objOption.Name
 Wscript.Echo "Overwrite Existing Debug File: " & _
 objOption.OverwriteExistingDebugFile
 Wscript.Echo "Send Administrative Alert: " & objOption.SendAdminAlert
 Wscript.Echo "Write Debug Information: " & objOption.WriteDebugInfo
 Wscript.Echo "Write to System Log: " & objOption.WriteToSystemLog
Next