Script to query perfmon (.blg) files

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Dave Wyatt Dave Wyatt 2 years, 4 months ago.

  • Author
    Posts
  • #17453
    Profile photo of Nathan OBryan
    Nathan OBryan
    Participant

    I have written a basic script to query the daily performance logs on an Exchange 2013 server. Download below from TechNet gallery

    http://gallery.technet.microsoft.com/Get-EDSData-46088d49#content

    It works fine for "standard" performance counters, but it does not work for counters with an * in them. Example \\Server\MSExchangeIS Store(*)\RPC Average Latency.

    The problem is that "\\Server\MSExchangeIS Store(*)\RPC Average Latency" is not actually a counter that exists on the server, it is a list set of counters. When you add that counter in perfmon, it adds one counter for each store on the server.

    I can expand the list set via Get-Counter -ListSet "MSExchange IS Store", then find the actual counter I want in the output and put that into the script, but I would like to get it working by just putting "MSExchangeIS Store(*)\RPC Average Latency" into the script and getting output for each Store on the server.

    Does that make sense?

    Anyone have any ideas on how I can get that working?

  • #17454
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    It looks lke Import-Counter also has a -ListSet parameter. Your script could run that command against the blg files, then compare your $Counter parameter (using wildcards to the list) before running Import-Counter again with the matching values. Something like this, though I haven't tested it:

    $counterList = @(Import-Counter -ListSet $env:exchangeinstallpath\Logging\Diagnostics\DailyPerformanceLogs\*.blg)
    $counterList = $counterList -like "\\$Server\$Counter"
    $Data = Import-Counter -Path $env:exchangeinstallpath\Logging\Diagnostics\DailyPerformanceLogs\*.blg -Counter $counterList
    

You must be logged in to reply to this topic.