PowerShell for Windows Admins

May 4 2011   2:03PM GMT

Reliability Records

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Want to know if there is something affecting the reliability of you system?  For Windows 7 and Windows 2008 R2 WMI providers some reliability metrics. They are enabled by default on Windows 7. group Policy has to be used to enable them on the server side.  See Computer Settings – Administrative Templates – Windows Components – Reliability

 

001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
function get-reliabilityrecords{
[CmdletBinding()]
param (
 [parameter(ValueFromPipeline=$true,
   ValueFromPipelineByPropertyName=$true)]
  [string]$computer=".",
 
  [string]
  [ValidateSet("System", "Application")]
  $logfile,
 
  [string]
  [ValidateSet(
    "Microsoft-Windows-WindowsUpdateClient ",
     "Application Error", 
     "MsiInstaller", 
     "Microsoft-Windows-UserPnp",
     "Application Hang", 
     "Application-Addon-Event-Provider",
     "EventLog")]
     $source
 
)
BEGIN{
 $filt = $null
 if ($logfile) {$filt += "LogFile = ‘$logfile’"}
 if ($source) {$filt += "AND SourceName =’$source’"}
 if ($filt){ 
   if ($filt.StartsWith("AND ")){$filt = $filt.Remove(0, 4)}
   Write-Debug $filt  
 }
 
}#begin

PROCESS{
 if ($filt){
   Get-WmiObject -Class Win32_ReliabilityRecords -Filter "$filt" -ComputerName $computer |
   select ComputerName, EventIdentifier, InsertionStrings, Logfile, Message,
   ProductName, RecordNumber, SourceName, 
   @{N="TimeGenerated"; E={$_.ConvertToDatetime($_.TimeGenerated)}}, 
   User
 }
 else{
   Get-WmiObject -Class Win32_ReliabilityRecords -ComputerName $computer |
   select ComputerName, EventIdentifier, InsertionStrings, Logfile, Message,
   ProductName, RecordNumber, SourceName, 
   @{N="TimeGenerated"; E={$_.ConvertToDatetime($_.TimeGenerated)}}, 
   User
 } 

}#process
END{}
#end

<# .SYNOPSIS Gets the Reliability Records of the System. This is only valid for Windows 7 and Windows Server 2008 R2 .DESCRIPTION Uses the Win32_ReliabilityRecords class. Records can be filtered by log file and source name .PARAMETER <Parameter-Name> Computer A string containing the computer name to access. .PARAMETER <Parameter-Name> source A string containing the source name used to write to the event logs. .PARAMETER <Parameter-Name> logfile A string containing the event log file name. Accepted values are "System" and "Application" .EXAMPLE get-reliabilityrecords -source "Application Hang" -debug | Format-Table TimeGenerated, ProductName, Message –wrap –AutoSize Returns the records from the Application Hang source .EXAMPLE get-reliabilityrecords -logfile application | Format-Table TimeGenerated, ProductName, Message –wrap –AutoSize Returns the records from the Application event log #>

}

 

The corresponding reliability metrics were covered here http://itknowledgeexchange.techtarget.com/powershell/system-stability/

I’ll be posting the two functions as another PSAM module on codeplex soon

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: