dingemans
-
Posts
3 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by dingemans
-
-
-ea silentlycontinue
Yep, that does the trick. Thanx!
That's to say, it suppresses the error message. Anyone else an idea what causes the error in the first place?
-
Installed PowerGadgets and tried the very first sample: ProcessCPUTime.ps1 from the Samples directory:
get-process | select name, CPU | sort TotalProcessorTime | out-chart -Values CPU -Label Name -title "Process CPU Time"
I get a chart, but not sorted. This is obvious, cause the select cmdlet does not specify TotalProcessorTime (exact same graph is displayed when I specify: sort blabla)
So I add TotalProcessorTime to the select cmdlet:
get-process | select name, CPU, TotalProcessorTime | sort TotalProcessorTime | out-chart -Values CPU -Label Name -title "Process CPU Time"
This time I get the chart bars sorted, but also:
Select-Object : Exception getting "TotalProcessorTime": "Access is denied"At line:1 char:21+ get-process | select <<<< name, CPU, TotalProcessorTime | sort TotalProcessorTime -desc | out-chart -Values CPU -Label Name -title "Process CPU Time"
The problem seems to be caused by the Idle process, as shown by:
get-process | select name, cpu, totalprocessorTime
FrameworkService 51.953125 00:00:51.9531250GoogleToolbarNotifier 0.953125 00:00:00.9531250Select-Object : Exception getting "TotalProcessorTime": "Access is denied"At line:1 char:21+ get-process | select <<<< name, cpu, totalprocessorTimeIdleiexplore 44.765625 00:00:44.7656250
The statement below does the job, but what is the reason for the error? Running all this as the Administrator on a Windows XP SP2 machine.
get-process | where { $_.name -ne "Idle" } | select name, CPU, TotalProcessorTime | sort TotalProcessorTime -desc | out-chart -Values CPU -Label Name -title "Process CPU Time"
Access denied on Idle process
in PowerGadgets Support
Posted
For the broader audience...
The link below describes the probable cause of the error:
http://blogs.msdn.com/powershell/archive/2006/04/30/586973.aspx
Seems that the Idle process has no TotalProcessorTime (nor StartTime, and perhaps more),
Back to the initial sample that ships with PowerGadgets. I'd suggest to sort on another property, not sort at all, or get rid of the idle process as in a previous reply.