I want to be able to query whether the currently logged in user is idle at their PC - i.e. their PC believes they are 'inactive'... The problem is there are so many ways this could be done. Is there a universal: "THIS COMPUTER IS IDLE/INACTIVE" - I'm thinking about using whatever measure the power subsystem uses...
My thought is to use WMI/Powershell but I could also use a .NET call in C# - I'd just rather not!
Sorry to be a bit vague on this and I'm more than happy for anybody to edit my question into something more meaningful!
Mike
If you're willing to hack it and look for a screensaver to detmine inactivity you might as well use powershell to see if the session is inactive (i.e. the computer is locked):
it uses the terminal services interface to see if a user is attached to a session. This works because in modern versions of windows all local users are treated as being console sessions of the computer. The two status of interest are:
As it's based on the old qwinsta functionality rather than being fully OO you'll need to do some string manipulation if you want a boolean out of it (i.e. -contains "Active").
For an accurate figure (and what screensavers themselves are generally driven by) look at the LastInputInfo() win32 API call but you need to run it in the user's context which is usually a deal breaker if you need remote monitoring. Here's the MSDN article though: http://msdn.microsoft.com/en-us/library/ms646302(VS.85).aspx
No is the simple answer.
I have in the past used WMI to list the running processes and looked for the screen saver. If the screen saver is running they are inactive in one sense, though you still can't tell if they've left an app running. You can check things like CPU and/or disk actvity, but it's hard to get a firm answer from these.
JR