Configuring Computer Recovery Options

Microsoft® Windows® 2000 Scripting Guide

microsoft windows 2000 scripting guide

« Previous | Next »   

You can configure a computer to take specific actions if it encounters an unrecoverable error condition. The actions you specify affect how long it takes to restart a computer and how much information will be available for diagnosing the cause of the error condition. This enables you to balance the need for recording information about the error condition (which can take a considerable amount of time, depending on how much memory is installed on the computer) with the need to have the computer operational as soon as possible.

You can control the amount of time required to restore a computer to full functionality by configuring the type of memory dump file that is written when the computer encounters an unrecoverable error condition. The different memory dump types vary greatly in the size of the file they generate; in turn, this affects the time it takes to write the file and the time it takes to restart the computer. (File sizes are also affected by the amount of memory installed on a computer.) Table 8.20 shows the relative sizes of the memory dump files on a Windows 2000 based computer with 512 MB of RAM.

Table 8.20   Relative Sizes of Memory Dump Files

Recovery OptionSize of Dump File
Complete memory dump512 MB
Kernel memory dump244 MB
Small memory dump64 KB

In addition to specifying the type of memory dump file to be generated, you can control other recovery options such as:

  • The folder in which memory dump files are stored.
  • Whether error condition events are saved in the System Event log.
  • Whether each new memory dump file is given a unique file name or whether new files overwrite existing memory dump files.

The Win32_OSRecoveryConfiguration class can be used to configure the recovery options for a computer. The properties available through this class are shown in Table 8.19.

Scripting Steps

Listing 8.22 contains a script that modifies the recovery configuration on 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 all the operating system recovery settings for the computer.

  4. For each set of recovery options in the collection, set the DebugFilePath to C:\Scripts\Memory.dmp.
  5. For each set of recovery options in the collection, configure the OverWriteExistingDebugFile property to False.

    If a debug file is found, it will not be overwritten.

  6. Use the Put_ method to apply the changes.

Listing 8.22   Modifying the Recovery Configuration on a Computer

1 2 3 4 5 6 7 8 9 10 
strComputer = "." Set objWMIService = GetObject("winmgmts:" _     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colRecoveryOptions = objWMIService.ExecQuery _     ("SELECT * FROM Win32_OSREcoveryConfiguration") For Each objOption in colRecoveryOptions     objOption.DebugFilePath = "c:\scripts\memory.dmp"     objOption.OverWriteExistingDebugFile = False     objOption.Put_ Next

send us your feedback Send us your feedback « Previous | Next »   


Microsoft Windows 2000 Scripting Guide(c) Automating System Administration 2003
Microsoft Windows 2000 Scripting Guide(c) Automating System Administration 2003
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 635

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net