Export-counter not exporting instances. Any advise ?

Welcome Forums General PowerShell Q&A Export-counter not exporting instances. Any advise ?

This topic contains 2 replies, has 2 voices, and was last updated by

1 year, 6 months ago.

  • Author
  • #78156

    Points: 1
    Rank: Member

    I am trying to create some solution for performance monitoring and facing some strange behavior of Export-counter.

    I am doing following:

    $counterLIst=((get-counter -listset Processor).PathsWithInstances | Where-Object {$_ -like "*Processor*" -and 
                                                                $_ -notlike "*Network*" -and $_ -notlike "*Thread*" -and ( 
                                                                 $_ -like "* Processor Time*" -or
                                                                 $_ -like "*Interrupts/sec*" 

    It gives me Processors counter list, that includes all the instances. Till than it is ok..

    I am able to view samples by:

    Get-counter -Counter $counterLIst -SampleInterval 2 -MaxSamples 5 

    And it is also working properly .

    But (!!!) when I am trying to export counters by:

    Get-counter -Counter $counterLIst -SampleInterval 2 -MaxSamples 5  | 
                        Export-counter -Force -Path  C:\Test.blg  

    It gives me only the Totals, without the instances!
    Why ?

    The only solution I managed to do is to gather counters without the Totals:

    $counterLIst=((get-counter  -listset Processor).PathsWithInstances | Where-Object {$_ -like "*Processor*" -and 
                                                                 $_ -notlike "*Total*" -and
                                                                $_ -notlike "*Network*" -and $_ -notlike "*Thread*" -and ( 
                                                                 $_ -like "* Processor Time*" -or
                                                                 $_ -like "*Interrupts/sec*" 

    In that case it is working, but I will not have Totals in the graph.

    Please advise…


  • #78232

    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    Your patience in not re-posting is appreciated, as indicated in the instructions above the posting textbox 🙂 Your posts were all held as spam, and re-posting the same thing repeatedly increases the system's view of you as a potential spammer. I check the queues daily for false positives.

    Yeah, so a lot of time, _Totals is set up as a distinct kind of instance, and it's really a pseudo-instance, so you kind of have to pick and choose. I've not played with it a ton, but I've run into that, and I wound up going with basically your last technique – and I did a second one for the totals.

  • #78247

    Points: 1
    Rank: Member

    Thanks !

The topic ‘Export-counter not exporting instances. Any advise ?’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort