Link to home
Start Free TrialLog in
Avatar of bibi92
bibi92Flag for France

asked on

for processes powershell do a sum of WorkingSetPrivate

Hello,

How can I modifiy this script for doing a sum of WorkingSetPrivate for all processes Powershell :

If ($ProcessName -eq "Powershell") {
  $ProcessList = gwmi Win32_PerfFormattedData_PerfProc_Process | where {$_.Name -eq $ProcessName} | select IDProcess,Name,WorkingSetPrivate | sort WorkingSetPrivate -Descending | select -First $SelectFirst
}

Thanks

Regards
ASKER CERTIFIED SOLUTION
Avatar of footech
footech
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If ($ProcessName -eq "Powershell") {
  $WSP = gwmi Win32_PerfFormattedData_PerfProc_Process | where {$_.Name -eq $ProcessName} | measure-object -sum WorkingSetPrivate | select -Expand Sum
}

Open in new window

Avatar of bibi92

ASKER

I have tested, the sum WorkingSetPrivate is only the result of the last process, I checked the result in column memory private working set with task manager
Avatar of bibi92

ASKER

gwmi Win32_PerfFormattedData_PerfProc_Process return the last process id
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bibi92

ASKER

Ok, I will test it. Thanks
bibi, http:#a40688399 will only get you one instance of the process. You'll need to make the process list generated with something like http:#a40689243 to get all instances' values.
Avatar of bibi92

ASKER

yes exactly thanks
Then points should get split.
Avatar of bibi92

ASKER

yes it's an error. How can I split?  thanks