View RSS Feed

FN-GM

Check who is logged into a machine

Rating: 2 votes, 5.00 average.
by , 9th February 2012 at 01:24 AM (13745 Views)
From time to time you may wish to find out who is logged into a machine. I find this batch file handy for doing this. Its quick, simple and easy.

Just copy and paste the below code into notepad and save the file as who.bat

Code:
@echo off

:CHECK
echo Checking Connection ...
ping %1 -n 1  | findstr "TTL=" >nul && GOTO MAIN || GOTO ERROR
GOTO END

:ERROR
echo Device Unreachable
GOTO END

:MAIN

wmic /node: "%1" computersystem get username

GOTO END

:END

echo.
Now open the command prompt. run to the location of the script then a space then the name of the machine. For example

C:\who.bat Computer1

All Done!
Categories
Uncategorized

Comments

  1. sonofsanta's Avatar
    That is very cool and useful. Tah muchly
  2. FN-GM's Avatar
    No worries i like it due its simplicity.
  3. Svarcy's Avatar
    Is there a way of getting the results back for an OU in Active Directory so rather than idividually targetting the machines we can pull a classroom list back?

Trackbacks

Total Trackbacks 0
Trackback URL: