开发者

Test If a PC is Logged in Over a Network

Is there any way using Perl, PS Tools, or Autoit, to test a PC,开发者_StackOverflow社区 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜