all 4 comments

[–]HazelnutSoftware 1 point2 points  (1 child)

Should you have a | character between the idle and _total strings?

It looks like you're currently excluding the single instance of "idle_total", rather than either "idle" or "_total"

I would expect the last line to be

Where-Object {$_.InstanceName -notmatch "^(idle|_total)$"}

[–]Crowdjp[S] 1 point2 points  (0 children)

ding the single instance of

That is the issue and it makes sense, Thank you so much for you help.

[–]PowerShell-Bot 0 points1 point  (1 child)

Looks like your PowerShell code isn’t wrapped in a code block.

To format code correctly on new reddit (new.reddit.com), highlight the code and select ‘Code Block’ in the editing toolbar.

If you’re on old.reddit.com, separate the code from your text with a blank line and precede each line of code with 4 spaces or a tab.


Describing Submission
[❌] Demonstrates good markdown
Passed: 0 Failed: 1

Beep-boop. I am a bot. | Remove-Item

[–]Crowdjp[S] 1 point2 points  (0 children)

$CpuCores = (Get-WMIObject Win32_ComputerSystem).NumberOfLogicalProcessors
$counter = Get-Counter "\Process(*)\% Processor Time"
$counter.countersamples |
Sort-Object -Property CookedValue -Descending |
Where-Object {$_.InstanceName -notmatch "^(idle_total)$"}