I found good script which shows what is value of cpu Load for specific process.
Here is the code:
"# Option A: This is if you just have the name of the process; partial name OK
$ProcessName = “java”
# Option B: This is for if you just have the PID; it will get the name for you
#$ProcessPID = “6860”
#$ProcessName = (Get-Process -Id $ProcessPID).Name
$CpuCores = (Get-WMIObject Win32_ComputerSystem).NumberOfLogicalProcessors
$Samples = (Get-Counter “\Process($Processname*)\% Processor Time”).CounterSamples
$Samples | Select `
InstanceName,
@{Name=”CPU %”;Expression={[Decimal]::Round(($_.CookedValue / $CpuCores), 2)}}"
It shows me all java process on computer with cpuloads of that process:
"InstanceName CPU %
------------ -----
java 0
java 1,92
java 29,23
java 4,23"
What if I want to add more columns to that report.
I need that report shows:
Instance name, CPU %, process PID, and most important cmdline of that process.
Is that possible using a script above, with some kind of corrections ?
Greetings
Alex