0

All,

I am using windows 7 os

I would like to know the idle time for each application or process running in my machine.

Ex: I opened one process like notepad.exe but I am not working on it from last 5 minutes, I need to get the idle time as 5 minutes for the process.

like that at one time I would like to know the idle time of all process running in my machine.
I tried the below code but I am not getting the any data for IdleTime

$processname = Get-Process | Select-Object -Property ProcessName, IdleTime,ID,WS

Please help me

surendra
  • 551
  • 3
  • 13
  • 27
  • Process information won't provide the kind of information you're looking for. Even if you're interacting with a program the process will be idle most of the time. You need some kind of activity tracking software for what you want to achieve. – Ansgar Wiechers May 29 '17 at 21:19

1 Answers1

0

There seems to be no property named Idletime. You can check that out by doing:

Get-Process | Get-Member -force

Perhaps parsing the WMI Win32_Process could help you achieve your goal? Try this:

$kerneltime = Get-WmiObject Win32_Process -Filter "Name='System idle process'" | Select KernelModeTime
$timeSpan = (new-object System.TimeSpan $kerneltime.KernelModeTime)