Jump to content
  • entries
    14
  • comments
    21
  • views
    264

Check who is logged into a machine


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

 

@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!

3 Comments


Recommended Comments

sonofsanta

Posted

That is very cool and useful. Tah muchly :D
FN-GM

Posted

No worries i like it due its simplicity. :)
Svarcy

Posted

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?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...