psloggedon automated script Filed Under: Perl
Introduction
Well before all let me tell you the reason why I did this perl script.
For all you may not know psloggedon is a tool part of the pstools package. Psloggedon is used to find which user is currently logged on to a specific PC.
This application is great and really cool but I just found myself doing scanning of various PCs during a long time specially as a needed to make sure that the PCs were online, as if not the application would take even longer to return an error because it couldn’t connect to the PC.
The script
This script will initially ping the device marked to make sure that the device is online. If the device is online then it will show you the name of the user logged on to the PC (if any). Read the script for further details.
Well this script has the following command line options:
remotewho {-f filename | -h hostname | -w filename}
-f
Will report the name of the logged on user for all PCs listed on the file. One device name or IP per line.
-h
Will report the name of the logged on user for the PC specified.
-w
Will save the output of the file to the specified filename
You can download the script from here.
Note: I just tested this script using a windows PC. In windows once you save that file add the extension .pl to the file (I had problems showing files with .pl extention on the website).
- Permalink
- Alberto Diaz
- 7 Aug 2008 3:33 PM
- Comments (3)
December 2nd, 2010 at 23:17
Hi, I am not familiar with your regex but I know that it’s causing the problem,when trying to find the date. Could you please try this on Windows 7 and you will see that it does not detect the logged in user even though he is logged in. Thanks.!
December 3rd, 2010 at 14:09
Hi Chris, thanks for the information. It looks like sometimes psloggedon doesn’t report a date next to the logon name but I’m working on a way to fix that problem.
December 3rd, 2010 at 14:58
Problem fixed. Sorry I don’t have a Windows 7 pc to try it on but I just tried on a winXP pc and looks like it works.