Clear screen when doing a continuous performance counter

This topic contains 4 replies, has 4 voices, and was last updated by Profile photo of Windows LiveUser144 Windows LiveUser144 6 months, 2 weeks ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #36570

    I am trying to get continuous disk IOPS on a server, but trying to forego the results from continuing to scroll down the screen. Instead, I'd like to clear the screen between samples to gather, and if possible do the same in an out-gridview view as well.

    $c="\PHysicalDisk(*)\Disk Reads/sec"
    get-counter -counter $c -computername server1 -continuous -sampleinterval 5

    Profile photo of thom schumacher
    thom schumacher

    you could use this endless loop that was provided here:

    Then make a script similar to this:

    $c="\PHysicalDisk(*)\Disk Reads/sec"
    $displaycount = 20
            $counter = get-counter -counter $c -sampleinterval 5
            if($i -eq $displaycount)
                $i = 0
            write-output $counter
      $sapi = New-Object -ComObject Sapi.SpVoice
      $sapi.Speak('Hey, you aborted me dammit!')
    Profile photo of Christian Sandfeld
    Christian Sandfeld

    This will not work with Out-Gridview, but you could "refresh" you console window with this

    $ComputerName = 'server1'
    $Counter = '\PHysicalDisk(*)\Disk Reads/sec' 
    $SampleInterval = 5
    Get-Counter -Counter $Counter -ComputerName $ComputerName -SampleInterval $SampleInterval -Continuous | ForEach-Object {
    Profile photo of Bob McCoy
    Bob McCoy

    There is no inherent way within that cmdet.

    while ($true) { cls; get-counter -counter $c -computername util1; sleep 5 }

    EDIT: Oops. Essentially the same as above. He was just quicker.


    Thanks all for your quick responses. I love this community and how much we are all willing to help each other out. I've tried Christian's solution and it looks like it will work for me.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.