New PowerShell Function: Get-SCOMPerformanceData – Simplifying SCOM Performance Data Retrieval

Download SCOMHelper Management Pack

As SCOM administrators, we’ve all been there, trying to extract performance data from System Center Operations Manager for analysis, reporting, or troubleshooting. While SCOM provides excellent monitoring capabilities, getting to the raw performance data programmatically has often involved complex SDK calls or diving deep into the Operations Manager database.

Today, I’m excited to introduce a new addition to the SCOMHelper PowerShell module: Get-SCOMPerformanceData, a comprehensive function that simplifies performance data retrieval from SCOM using the native PowerShell SDK.


What Makes This Function Special?

The Get-SCOMPerformanceData function bridges the gap between SCOM’s powerful monitoring capabilities and the need for accessible performance data. Here’s what sets it apart:

  • Query by computer name: Get-SCOMPerformanceData -ComputerName "SQL01.domain.com"
  • Query by monitoring object GUID: Get-SCOMPerformanceData -Id "c5a9c43c-84d9-a3c2-6e84-c9d68bf79aa1"


Rich Statistical Analysis

Instead of just raw data points, the function automatically calculates:

  • Last Value: Most recent sample
  • Maximum Value: Peak value in the time range
  • Average Value: Mean value across the entire period


Smart Filtering

  • Filter by specific performance counters
  • Configurable time ranges (default: 72 hours)
  • Discovery mode to explore available counters without data retrieval


Performance Optimized

  • Built-in discovery mode (-PerfObjectsOnly) for metadata-only queries
  • Selective counter filtering to reduce data transfer
  • Verbose logging for troubleshooting


Real-World Examples

Quick Server Health Check

# Connect to SCOM and get basic performance data
New-SCOMManagementGroupConnection -ComputerName "ms21.contoso.com"
$AllCounters = Get-SCOMPerformanceData -ComputerName "SQL23.contoso.com" -PerfObjectsOnly
$PerfData = Get-SCOMPerformanceData -ComputerName "SQL23.contoso.com" -HoursLookback 96 -CounterNames $AllCounters.CounterName
$PerfData | Select-Object ObjectName, CounterName, InstanceName, LastValue, AverageValue | Format-Table

Disk Comparison: 1 Day, 1 Week

$hostname = 'ms21.contoso.com'

$DiskCounters = @("Free Megabytes", "% Free Space")
$Last96Hours = Get-SCOMPerformanceData -ComputerName $hostname -CounterNames $DiskCounters -HoursLookback 96
$Last7Days = Get-SCOMPerformanceData -ComputerName $hostname -CounterNames $DiskCounters -HoursLookback 168

# Compare disk usage trends
$DiskComparison = $Last96Hours | ForEach-Object {
    $Counter = $_
    $SevenDayAvg = ($Last7Days | Where-Object { 
        $_.ObjectName -eq $Counter.ObjectName -and 
        $_.CounterName -eq $Counter.CounterName -and 
        $_.InstanceName -eq $Counter.InstanceName 
    }).AverageValue
    
    [PSCustomObject]@{
        Drive = $Counter.InstanceName
        Counter = $Counter.CounterName
        Last96HrAvg = [math]::Round($Counter.AverageValue, 2)
        Last7DayAvg = [math]::Round($SevenDayAvg, 2)
        Trend = if ($Counter.AverageValue -lt $SevenDayAvg) { "Decreasing" } else { "Increasing" }
    }
}
$DiskComparison | Format-Table

Targeted Performance Analysis

# Focus on specific performance bottlenecks
$BottleneckCounters = @("% Processor Time", "Available MBytes", "Current Disk Queue Length")
$PerfData = Get-SCOMPerformanceData -ComputerName "WEB01.domain.com" -CounterNames $BottleneckCounters -HoursLookback 96

# Analyze CPU utilization
$CPUData = $PerfData | Where-Object { $_.CounterName -eq "% Processor Time" }
Write-Host "Average CPU: $([math]::Round($CPUData.AverageValue, 2))%"
Write-Host "Peak CPU: $([math]::Round($CPUData.MaximumValue, 2))%"

Counter Discovery

# Discover available performance counters without retrieving data
$PerfObjects = Get-SCOMPerformanceData -ComputerName "web21.contoso.com" -PerfObjectsOnly
$UniqueCounters = $PerfObjects | Select-Object ObjectName, CounterName, InstanceName | Sort-Object ObjectName, CounterName

$UniqueCounters | Group-Object ObjectName | ForEach-Object {
    Write-Host "Performance Object: $($_.Name)" -ForegroundColor Green
    $_.Group | ForEach-Object { Write-Host "  $($_.CounterName) [$($_.InstanceName)]" }
}

Multi-Server Reporting

# Export performance data from multiple servers to CSV, lookback 168 (1 week)
$DiskCounters = @("Free Megabytes", "% Free Space")

# Export performance data from multiple servers to CSV, lookback 168 (1 week)
$Servers = @("SQL23.contoso.com", "WEB21.contoso.com", "sqlrpt21.contoso.com")
$AllPerfData = @()

foreach ($Server in $Servers) {
    Write-Host "Collecting data from $Server..."
    $ServerData = Get-SCOMPerformanceData -ComputerName $Server -HoursLookback 168 -CounterNames $DiskCounters
    $ServerData | ForEach-Object {
        $_ | Add-Member -NotePropertyName "ServerName" -NotePropertyValue $Server
    }
    $AllPerfData += $ServerData
}

$AllPerfData | Export-Csv -Path "C:\Reports\PerformanceData.csv" -NoTypeInformation


Output Structure

The function returns rich objects with comprehensive metadata:

  • ObjectName
  • CounterName
  • InstanceName
  • AverageValue
  • LastValue
  • MaximumValue
  • RawData
  • MonitoringClassId
  • MonitoringObjectDisplayName
  • MonitoringObjectFullName
  • MonitoringObjectId
  • MonitoringObjectPath
  • MonitoringRuleDescription
  • MonitoringRuleDisplayName
  • MonitoringRuleId
  • ScaleFactor
  • ServerName

With the -PerfObjectsOnly switch, get performance object metadata for the performance collection rule:

  • ClassId
  • CounterName
  • HasSignature
  • Id
  • InstanceName
  • LastSampledValue
  • LearningMonitoringRuleId
  • LearningRuleId
  • ManagementGroup
  • ManagementGroupId
  • MonitoringClassId
  • MonitoringObjectDisplayName
  • MonitoringObjectFullName
  • MonitoringObjectId
  • MonitoringObjectName
  • MonitoringObjectPath
  • MonitoringRuleDescription
  • MonitoringRuleDisplayName
  • MonitoringRuleId
  • ObjectName
  • RuleDescription
  • RuleDisplayName
  • RuleId
  • ScaleFactor
  • ScaleLegend


Use Cases & Benefits

Troubleshooting

  • Quickly identify performance bottlenecks
  • Compare performance across different time periods
  • Validate alert thresholds against actual data

Capacity Planning

  • Export historical performance data for trend analysis
  • Generate custom reports for management
  • Integrate with external analytics tools

Proactive Monitoring

  • Automated health checks with custom thresholds
  • Early warning systems for resource exhaustion
  • Performance baseline establishment

Prerequisites & Best Practices

Requirements

  • SCOM 2012 or later with PowerShell SDK
  • Active SCOM management group connection
  • Appropriate SCOM permissions for monitoring objects
  • PowerShell 3.0 or later

Performance Tips

  • Use CounterNames parameter to filter for specific metrics
  • Leverage PerfObjectsOnly for discovery scenarios
  • Be mindful of HoursLookback values with large environments
  • Use -Verbose for troubleshooting

Common Counter Names

  • % Free Space
  • % Idle Time
  • % Processor Time
  • Active File Uploads
  • agent processor utilization
  • AuthenticationDurationMS
  • Available MBytes
  • Avg. Batch Processing Time, ms
  • Avg. Batch Size
  • Avg. Disk sec/Transfer
  • Avg. Processing Time
  • Batches/sec
  • Bind Data Source Item Drop Rate
  • Bind Data Source Item Incoming Rate
  • Bytes Total/sec
  • Client Connections
  • Consumed(%)
  • Current Bandwidth
  • Current Disk Queue Length
  • Data Items/sec
  • DaysUntilExpiration
  • Dropped Batch Count
  • Dropped Data Item Count
  • Errors/sec
  • Free Megabytes
  • Free System Page Table Entries
  • Handle Count
  • LastExitCode
  • Module Count
  • Pages/sec
  • Percent Processor Time
  • PercentBandwidthUsedTotal
  • PercentMemoryUsed
  • Plumbuses (units)
  • Pool Nonpaged Bytes
  • Pool Paged Bytes
  • Private Bytes
  • Processor Queue Length
  • Send Queue % Used
  • Send Queue Size
  • System Up Time
  • Thread Count
  • Total Error Count
  • Total Web Application Response Time
  • Workflow Count
  • Working Set


Getting Started

The Get-SCOMPerformanceData function is part of the SCOMHelper module. To get started:

  1. Install the SCOMHelper module (if not already installed)
  2. Connect to your SCOM management group:
New-SCOMManagementGroupConnection -ComputerName "mgmtserver.domain.com"

3. Start querying performance data:

Get-SCOMPerformanceData -ComputerName "target-server.domain.com"


Looking Forward

This function represents a significant step toward making SCOM performance data more accessible to PowerShell users. Whether you’re building custom dashboards, performing capacity planning, or troubleshooting performance issues, Get-SCOMPerformanceData provides the foundation for data-driven SCOM administration.

The comprehensive help documentation includes detailed examples for various scenarios, from simple health checks to complex multi-server analysis. I encourage you to explore the different parameter combinations and discover how this function can streamline your SCOM workflows.

Leave a Reply

Your email address will not be published. Required fields are marked *