Find performance collection rule for specific Object, Counter or Instance

Find collection rule that is writing specific performance object to the database

Foreach ($rule in (get-rule | where {$_.category -eq "PerformanceCollection"} | foreach-object {$_.DataSourceCollection}))
    {
    if ($rule.get_Configuration() -match "ObjectName>object</ObjectName")
        {$rule.get_ParentElement().DisplayName}
    }

Find collection rule that is writing specific performance counter to the database

Foreach ($rule in (get-rule | where {$_.category -eq "PerformanceCollection"} | foreach-object {$_.DataSourceCollection}))
    {
    if ($rule.get_Configuration() -match "CounterName>counter</CounterName")
        {$rule.get_ParentElement().DisplayName}
    }

Find collection rule that is writing specific performance counter instance to the database

Foreach ($rule in (get-rule | where {$_.category -eq "PerformanceCollection"} | foreach-object {$_.DataSourceCollection}))
    {
    if ($rule.get_Configuration() -match "InstanceName>instance</InstanceName")
        {$rule.get_ParentElement().DisplayName}
    }

Find collection rule that is writing specific performance object-counter-instance combination to the database

Foreach ($rule in (get-rule | where {$_.category -eq "PerformanceCollection"} | foreach-object {$_.DataSourceCollection}))
    {
    if ($rule.get_Configuration() -match "CounterName>counter</CounterName><ObjectName>object</ObjectName><InstanceName>instance</InstanceName")
        {$rule.get_ParentElement().DisplayName}
    }

main menu