Win32_OSRecoveryConfiguration

The Win32_OSRecoveryConfiguration WMI class represents the types of information that will be gathered from memory when the operating system fails. This includes boot failures and system crashes.

The Win32_OSRecoveryConfiguration WMI class represents the types of information that will be gathered from memory when the operating system fails. This includes boot failures and system crashes.

Methods

Win32_OSRecoveryConfiguration has no methods.

Properties

Win32_OSRecoveryConfiguration returns 15 properties:

'AutoReboot','Caption','DebugFilePath','DebugInfoType','Description',
'ExpandedDebugFilePath','ExpandedMiniDumpDirectory','KernelDumpOnly','MiniDumpDirectory','Name',
'OverwriteExistingDebugFile','SendAdminAlert','SettingID','WriteDebugInfo','WriteToSystemLog'

Unless explicitly marked as writeable, all properties are read-only. Read all properties for all instances:

Get-CimInstance -ClassName Win32_OSRecoveryConfiguration -Property *

Most WMI classes return one or more instances.

When Get-CimInstance returns no result, then apparently no instances of class Win32_OSRecoveryConfiguration exist. This is normal behavior.

Either the class is not implemented on your system (may be deprecated or due to missing drivers, i.e. CIM_VideoControllerResolution), or there are simply no physical representations of this class currently available (i.e. Win32_TapeDrive).

AutoReboot

WRITEABLE BOOLEAN

System will automatically reboot during a recovery operation.

Get-CimInstance -ClassName Win32_OSRecoveryConfiguration | Select-Object -Property Name, AutoReboot

Caption

STRING MAX 64 CHAR

Short textual description of the current object.

Get-CimInstance -ClassName Win32_OSRecoveryConfiguration | Select-Object -Property Name, Caption

DebugFilePath

WRITEABLE STRING

Full path to the debug file. A debug file is created with the memory state of the computer after a computer failure.

Example: “C:\Windows\Memory.dmp”

Get-CimInstance -ClassName Win32_OSRecoveryConfiguration | Select-Object -Property Name, DebugFilePath

DebugInfoType

WRITEABLE UINT32

Type of debugging information written to the log file.

DebugInfoType returns a numeric value. To translate it into a meaningful text, use any of the following approaches:

Use a PowerShell Hashtable
$DebugInfoType_map = @{
      0 = 'None'
      1 = 'Complete memory dump'
      2 = 'Kernel memory dump'
      3 = 'Small memory dump'
}
Use a switch statement
switch([int]$value)
{
  0          {'None'}
  1          {'Complete memory dump'}
  2          {'Kernel memory dump'}
  3          {'Small memory dump'}
  default    {"$value"}
}
Use Enum structure
Enum EnumDebugInfoType
{
  None                   = 0
  Complete_memory_dump   = 1
  Kernel_memory_dump     = 2
  Small_memory_dump      = 3
}

Examples

Use $DebugInfoType_map in a calculated property for Select-Object
<# 
  this example uses a hashtable to translate raw numeric values for 
  property "DebugInfoType" to friendly text

  Note: to use other properties than "DebugInfoType", look up the appropriate 
  translation hashtable for the property you would like to use instead.
#>

#region define hashtable to translate raw values to friendly text

# Please note: this hashtable is specific for property "DebugInfoType" 
# to translate other properties, use their translation table instead
$DebugInfoType_map = @{
      0 = 'None'
      1 = 'Complete memory dump'
      2 = 'Kernel memory dump'
      3 = 'Small memory dump'
}

#endregion define hashtable

#region define calculated property (to be used with Select-Object)

<#
  a calculated property is defined by a hashtable with keys "Name" and "Expression"
  "Name" defines the name of the property (in this example, it is "DebugInfoType", but you can rename it to anything else)
  "Expression" defines a scriptblock that calculates the content of this property
  in this example, the scriptblock uses the hashtable defined earlier to translate each numeric
  value to its friendly text counterpart:
#>
 
$DebugInfoType = @{
  Name = 'DebugInfoType'
  Expression = {
    # property is an array, so process all values
    $value = $_.DebugInfoType
    $DebugInfoType_map[[int]$value]
  }  
}
#endregion define calculated property

# retrieve the instances, and output the properties "Caption" and "DebugInfoType". The latter
# is defined by the hashtable in $DebugInfoType: 
Get-CimInstance -Class Win32_OSRecoveryConfiguration | Select-Object -Property Caption, $DebugInfoType

# ...or dump content of property DebugInfoType:
$friendlyValues = Get-CimInstance -Class Win32_OSRecoveryConfiguration | 
    Select-Object -Property $DebugInfoType |
    Select-Object -ExpandProperty DebugInfoType

# output values
$friendlyValues

# output values as comma separated list
$friendlyValues -join ', '

# output values as bullet list
$friendlyValues | ForEach-Object { "- $_" }
Use $DebugInfoType_map to directly translate raw values from an instance
<# 
  this example uses a hashtable to manually translate raw numeric values 
  for property "Win32_OSRecoveryConfiguration" to friendly text. This approach is ideal when
  there is just one instance to work with.

  Note: to use other properties than "Win32_OSRecoveryConfiguration", look up the appropriate 
  translation hashtable for the property you would like to use instead.
#>

#region define hashtable to translate raw values to friendly text

# Please note: this hashtable is specific for property "Win32_OSRecoveryConfiguration" 
# to translate other properties, use their translation table instead
$DebugInfoType_map = @{
      0 = 'None'
      1 = 'Complete memory dump'
      2 = 'Kernel memory dump'
      3 = 'Small memory dump'
}

#endregion define hashtable

# get one instance:
$instance = Get-CimInstance -Class Win32_OSRecoveryConfiguration | Select-Object -First 1

<#
  IMPORTANT: this example processes only one instance to illustrate
  the number-to-text translation. To process all instances, replace
  "Select-Object -First 1" with a "Foreach-Object" loop, and use
  the iterator variable $_ instead of $instance
#>

# query the property
$rawValue = $instance.DebugInfoType  

# translate raw value to friendly text:
$friendlyName = $DebugInfoType_map[[int]$rawValue]

# output value
$friendlyName
Use a switch statement inside a calculated property for Select-Object
<# 
  this example uses a switch clause to translate raw numeric 
  values for property "DebugInfoType" to friendly text. The switch
  clause is embedded into a calculated property so there is
  no need to refer to external variables for translation.

  Note: to use other properties than "DebugInfoType", look up the appropriate 
  translation switch clause for the property you would like to use instead.
#>

#region define calculated property (to be used with Select-Object)

<#
  a calculated property is defined by a hashtable with keys "Name" and "Expression"
  "Name" defines the name of the property (in this example, it is "DebugInfoType", but you can rename it to anything else)
  "Expression" defines a scriptblock that calculates the content of this property
  in this example, the scriptblock uses the hashtable defined earlier to translate each numeric
  value to its friendly text counterpart:
#>
 
$DebugInfoType = @{
  Name = 'DebugInfoType'
  Expression = {
    # property is an array, so process all values
    $value = $_.DebugInfoType
    
    switch([int]$value)
      {
        0          {'None'}
        1          {'Complete memory dump'}
        2          {'Kernel memory dump'}
        3          {'Small memory dump'}
        default    {"$value"}
      }
      
  }  
}
#endregion define calculated property

# retrieve all instances...
Get-CimInstance -ClassName Win32_OSRecoveryConfiguration | 
  # ...and output properties "Caption" and "DebugInfoType". The latter is defined
  # by the hashtable in $DebugInfoType:
  Select-Object -Property Caption, $DebugInfoType
Use the Enum from above to auto-translate the code values
<# 
  this example translates raw values by means of type conversion
  the friendly names are defined as enumeration using the
  keyword "enum" (PowerShell 5 or better)
  
  The raw value(s) are translated to friendly text by 
  simply converting them into the enum type.
  
  Note: to use other properties than "Win32_OSRecoveryConfiguration", look up the appropriate 
  enum definition for the property you would like to use instead.
#>


#region define enum with value-to-text translation:
Enum EnumDebugInfoType
{
  None                   = 0
  Complete_memory_dump   = 1
  Kernel_memory_dump     = 2
  Small_memory_dump      = 3
}

#endregion define enum

# get one instance:
$instance = Get-CimInstance -Class Win32_OSRecoveryConfiguration | Select-Object -First 1

<#
  IMPORTANT: this example processes only one instance to focus on
  the number-to-text type conversion. 
  
  To process all instances, replace   "Select-Object -First 1" 
  with a "Foreach-Object" loop, and use the iterator variable 
  $_ instead of $instance
#>

# query the property:
$rawValue = $instance.DebugInfoType

#region using strict type conversion

<#
  Note: strict type conversion fails if the raw value is 
  not defined by the enum. So if the list of allowable values
  was extended and the enum does not match the value,
  an exception is thrown
#>

# convert the property to the enum **DebugInfoType** 
[EnumDebugInfoType]$rawValue 

# get a comma-separated string:
[EnumDebugInfoType]$rawValue -join ',' 
#endregion

#region using operator "-as"

<#
  Note: the operator "-as" accepts values not defined
  by the enum and returns $null instead of throwing
  an exception
#>

$rawValue -as [EnumDebugInfoType]
#endregion

Enums must cover all possible values. If DebugInfoType returns a value that is not defined in the enum, an exception occurs. The exception reports the value that was missing in the enum. To fix, add the missing value to the enum.

Description

STRING

Textual description of the current object.

Get-CimInstance -ClassName Win32_OSRecoveryConfiguration | Select-Object -Property Name, Description

ExpandedDebugFilePath

WRITEABLE STRING

Expanded version of the DebugFilePath property.

Example: “C:\Windows\Memory.dmp”

Get-CimInstance -ClassName Win32_OSRecoveryConfiguration | Select-Object -Property Name, ExpandedDebugFilePath

ExpandedMiniDumpDirectory

WRITEABLE STRING

Expanded version of the MiniDumpDirectory property.

Example: “C:\Windows\MiniDump”

Get-CimInstance -ClassName Win32_OSRecoveryConfiguration | Select-Object -Property Name, ExpandedMiniDumpDirectory

KernelDumpOnly

WRITEABLE BOOLEAN

Only kernel debug information will be written to the debug log file. If TRUE, then only the state of the kernel is written to a file in the event of a system failure. If FALSE, the system will try to log the state of the memory, and any devices that can provide information about the system when it failed.

Get-CimInstance -ClassName Win32_OSRecoveryConfiguration | Select-Object -Property Name, KernelDumpOnly

MiniDumpDirectory

WRITEABLE STRING

Directory where small memory dump files will be recorded and accumulated.

Example: “%systemRoot%\MiniDump”

Get-CimInstance -ClassName Win32_OSRecoveryConfiguration | Select-Object -Property Name, MiniDumpDirectory

Name

KEY PROPERTY STRING MAX 256 CHAR

Identifying name for this instance of the Win32_OSRecoveryConfiguration class.

Get-CimInstance -ClassName Win32_OSRecoveryConfiguration | Select-Object -Property Name

OverwriteExistingDebugFile

WRITEABLE BOOLEAN

New debug file will overwrite an existing one.

Get-CimInstance -ClassName Win32_OSRecoveryConfiguration | Select-Object -Property Name, OverwriteExistingDebugFile

SendAdminAlert

WRITEABLE BOOLEAN

Alert message will be sent to the system administrator in the event of an operating system failure.

Get-CimInstance -ClassName Win32_OSRecoveryConfiguration | Select-Object -Property Name, SendAdminAlert

SettingID

STRING MAX 256 CHAR

Identifier by which the current object is known.

Get-CimInstance -ClassName Win32_OSRecoveryConfiguration | Select-Object -Property Name, SettingID

WriteDebugInfo

WRITEABLE BOOLEAN

Debugging information is to be written to a log file.

Get-CimInstance -ClassName Win32_OSRecoveryConfiguration | Select-Object -Property Name, WriteDebugInfo

WriteToSystemLog

WRITEABLE BOOLEAN

Events will be written to a system log.

Get-CimInstance -ClassName Win32_OSRecoveryConfiguration | Select-Object -Property Name, WriteToSystemLog

Examples

List all instances of Win32_OSRecoveryConfiguration
Get-CimInstance -ClassName Win32_OSRecoveryConfiguration

Learn more about Get-CimInstance and the deprecated Get-WmiObject.

View all properties
Get-CimInstance -ClassName Win32_OSRecoveryConfiguration -Property *
View key properties only
Get-CimInstance -ClassName Win32_OSRecoveryConfiguration -KeyOnly

Selecting Properties

To select only some properties, pipe the results to Select-Object -Property a,b,c with a comma-separated list of the properties you require. Wildcards are permitted.

Get-CimInstance always returns all properties but only retrieves the ones that you specify. All other properties are empty but still present. That’s why you need to pipe the results into Select-Object if you want to limit the visible properties, i.e. for reporting.

Selecting Properties

The code below lists all available properties. Remove the ones you do not need:

$properties = 'AutoReboot',
              'Caption',
              'DebugFilePath',
              'DebugInfoType',
              'Description',
              'ExpandedDebugFilePath',
              'ExpandedMiniDumpDirectory',
              'KernelDumpOnly',
              'MiniDumpDirectory',
              'Name',
              'OverwriteExistingDebugFile',
              'SendAdminAlert',
              'SettingID',
              'WriteDebugInfo',
              'WriteToSystemLog'
Get-CimInstance -ClassName Win32_OSRecoveryConfiguration | Select-Object -Property $properties
Limiting Network Bandwidth

If you work remotely, it makes sense to limit network bandwidth by filtering the properties on the server side, too:

Get-CimInstance -Class Win32_OSRecoveryConfiguration -Property $property | 
Select-Object -Property $property

Selecting Instances

To select some instances, use Get-CimInstance and a WMI Query. The wildcard character in WMI Queries is % (and not “*”).

The parameter -Filter runs a simple query.

Listing all instances where the property Caption starts with “A”
Get-CimInstance -Class Win32_OSRecoveryConfiguration -Filter 'Caption LIKE "a%"' 
Using a WQL Query

The parameter -Query uses a query similar to SQL and combines the parameters -Filter and -Property. This returns all instances where the property Caption starts with “A”, and returns the properties specified:

Get-CimInstance -Query "SELECT SendAdminAlert, DebugFilePath, AutoReboot, Caption FROM Win32_OSRecoveryConfiguration WHERE Caption LIKE 'a%'"

Any property you did not specify is still present but empty. You might need to use Select-Object to remove all unwanted properties:

Get-CimInstance -Query "SELECT SendAdminAlert, DebugFilePath, AutoReboot, Caption FROM Win32_OSRecoveryConfiguration WHERE Caption LIKE 'a%'" | Select-Object -Property SendAdminAlert, DebugFilePath, AutoReboot, Caption

Accessing Remote Computers

To access remote systems, you need to have proper permissions. User the parameter -ComputerName to access one or more remote systems.

Authenticating as Current User
# one or more computer names or IP addresses:
$list = 'server1', 'server2'

# authenticate with your current identity:
$result = Get-CimInstance -ClassName Win32_OSRecoveryConfiguration -ComputerName $list 
$result
Authenticating as Different User

Use a CIMSession object to authenticate with a new identity:

# one or more computer names or IP addresses:
$list = 'server1', 'server2'

# authenticate with a different identity:
$cred = Get-Credential -Message 'Authenticate to retrieve WMI information:'
$session = New-CimSession -ComputerName $list -Credential $cred

$result = Get-CimInstance Win32_OSRecoveryConfiguration -CimSession $session

# remove the session after use (if you do not plan to re-use it later)
Remove-CimSession -CimSession $session

$result

Learn more about accessing remote computers.

Requirements

To use Win32_OSRecoveryConfiguration, the following requirements apply:

PowerShell

Get-CimInstance was introduced with PowerShell Version 3.0, which in turn was introduced on clients with Windows 8 and on servers with Windows Server 2012.

If necessary, update Windows PowerShell to Windows PowerShell 5.1, or install PowerShell 7 side-by-side.

Operating System

Win32_OSRecoveryConfiguration was introduced on clients with Windows Vista and on servers with Windows Server 2008.

Namespace

Win32_OSRecoveryConfiguration lives in the Namespace Root/CIMV2. This is the default namespace. There is no need to use the -Namespace parameter in Get-CimInstance.

Implementation

Win32_OSRecoveryConfiguration is implemented in CIMWin32.dll and defined in CIMWin32.mof. Both files are located in the folder C:\Windows\system32\wbem:

explorer $env:windir\system32\wbem
notepad $env:windir\system32\wbem\CIMWin32.mof