Jump to content
Software FX Community
Sign in to follow this  
dingemans

Access denied on Idle process

Recommended Posts

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"

 

Share this post


Link to post
Share on other sites

Not sure why you are getting the error. But to get rid of it try:

get-process | select name, CPU, TotalProcessorTime -ea silentlycontinue | sort TotalProcessorTime | out-chart -Values CPU -Label Name -title "Process CPU Time"

 This is just an erroraction that tells the error not to show up. You can also put in a -refresh 00:00:01 and the error will not show up.

HTH,valdezdj

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Another example of the issue:

http://www.c-sharpcorner.com/Forums/ShowMessages.aspx?ThreadID=33709

I've not been able to find anything "official", but as you mention, it appears the idle process object has different properties.

Thanks for pointing this out.  I had never tried this combination of properties.  Did you still want to graph this object?  I'm sure there's a workaround to manually calculating some of the values and graphing them along with the others.

Marco

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...