Q: Get-counter Process(*)\... does not work

Hi all,

I’m trying to collect perfmon data from multiple remote machines regarding their process.

I thought putting in a wildcard “Process(*)…” would solve this but all get is an error:

get-counter : The data in one of the performance counter samples is not valid.

I don’t have a clue what to do to get a specfic perfmon counter for all the processes from a remote machine.

regards

Christian

You can access the processor data like this

Get-Counter -Counter ‘\Process(*)% Processor Time’

Are you after all counters for all processes?

In which case you’ll need to collect all of these
\Process()% Processor Time
\Process(
)% User Time
\Process()% Privileged Time
\Process(
)\Virtual Bytes Peak
\Process()\Virtual Bytes
\Process(
)\Page Faults/sec
\Process()\Working Set Peak
\Process(
)\Working Set
\Process()\Page File Bytes Peak
\Process(
)\Page File Bytes
\Process()\Private Bytes
\Process(
)\Thread Count
\Process()\Priority Base
\Process(
)\Elapsed Time
\Process()\ID Process
\Process(
)\Creating Process ID
\Process()\Pool Paged Bytes
\Process(
)\Pool Nonpaged Bytes
\Process()\Handle Count
\Process(
)\IO Read Operations/sec
\Process()\IO Write Operations/sec
\Process(
)\IO Data Operations/sec
\Process()\IO Other Operations/sec
\Process(
)\IO Read Bytes/sec
\Process()\IO Write Bytes/sec
\Process(
)\IO Data Bytes/sec
\Process()\IO Other Bytes/sec
\Process(
)\Working Set - Private

Hi Richard,

I want to collect data from all process for these counters:

“\logicaldisk(_total)\Disk Transfers/Sec”,
“\Process()\IO Write Bytes/sec",
"\Process(
)\IO Read Bytes/sec”,
“Process(_total)\IO Data Operations/sec” ,
“\Process(_total)\IO Write Bytes/sec”,
“\Process(_total)\IO Read Bytes/sec”

The command I used this one. I only get the (_Total) counter returned but nothing from the wildcard * ones.

invoke-command -ComputerName MYCOMPUTER {get-counter -ComputerName $randomset.hostedmachinename -counter “\logicaldisk(_total)\Disk Transfers/Sec”,"\Process()\IO Write Bytes/sec","\Process()\IO Read Bytes/sec",“Process(*)\IO Data Operations/sec”,“Process(_total)\IO Data Operations/sec” ,"\Process(_total)\IO Write Bytes/sec", “\Process(_total)\IO Read Bytes/sec” -SampleInterval 3 -Continuous| Export-counter -force -Path c:\temp\myoutput.blg}

When I run this command I get these errors:

Internal performance counter API call failed. Error: c0000bc4.
+ CategoryInfo : InvalidResult: (:slight_smile: [Get-Counter], Exception
+ FullyQualifiedErrorId : CounterApiError,Microsoft.PowerShell.Commands.GetCounterCommand

The data in one of the performance counter samples is not valid. View the Status property for each PerformanceCounterSample object to make sure it contains valid
data.
+ CategoryInfo : InvalidResult: (:slight_smile: [Get-Counter], Exception
+ FullyQualifiedErrorId : CounterApiError,Microsoft.PowerShell.Commands.GetCounterCommand

regards

Christian

why are you using the computername parameter on get-counter inside the invoke-command script block?

put the computer name on invoke-command or get-counter not both

have you tried running these commands locally on any of the machines where its failing

Ah sorry, that was a typo.

copy pasted the wrong passage.

The test was performed without the -computer parameter in the script block.

invoke-command -ComputerName MYCOMPUTER {get-counter -counter “\logicaldisk(_total)\Disk Transfers/Sec”,"\Process()\IO Write Bytes/sec","\Process()\IO Read Bytes/sec",“Process(*)\IO Data Operations/sec”,“Process(_total)\IO Data Operations/sec” ,"\Process(_total)\IO Write Bytes/sec", “\Process(_total)\IO Read Bytes/sec” -SampleInterval 3 -Continuous| Export-counter -force -Path c:\temp\myoutput.blg}

When I run this command against my own box I get the same result. the .blg file only provides the (_Total) collected counters and ISE is wrinting errors:

get-counter : The data in one of the performance counter samples is not valid. View the Status property for each PerformanceCounterSample object to make sure it
contains valid data.
At line:1 char:1

  • get-counter -ComputerName MYCOMPUTER -counter "\logicaldisk(_total)\Disk Tran …

…I don’t understand though why it states that \logicaldisk(_total)\Disk Tran … is not valid. This data is available in the .blg file.

What I don’t get is, if I run the same collection in the perfmon GUI I am able to collect all the data. Via PS it failes on the wildcard * ones.

regards

Christian

I did another test:

get-counter -ComputerName MYCOMPUTER-counter “\Process(spoolsv)\IO Write Bytes/sec” -SampleInterval 3 -Continuous| Export-counter -force -Path c:\temp\myoutput.blg

Using an explicit process name worked. Why does’s * work. In Perfmon it’s called .

regards

Christian