Question

Is there any way using Perl, PS Tools, or Autoit, to test a PC, over my network, to see if it is powered on and logged in?

For example:

  • Script begins
  • Script tests pc to see if it is powered on and logged in as a user
  • Script runs a task on that pc

A Plus:

  • Return 0 if the pc is not logged in and/or powered off
  • Return the user name of who ever is logged in.
Was it helpful?

Solution

TASKLIST /S hostname /U username
TASKLIST /S hostname /U domain\username

will show you all the tasks that a user is running on a machine. If it returns an error or no output, then the user is not logged on. Otherwise, you parse the program list and decide for yourself whether the programs indicate that the user is logged on, or there are just some tasks running in the background on his/her behalf.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top