If you need to know whether anyone is logged into a remote computer in your domain or who that might be, you can use LoggedOn.vbs, a script I found at List User Logged On To A Remote Computer, which was written by Cheyenne Harden and is available at the LazyNetworkAdmin.Com website or from this site (see links below).
To use the utility, you can enter LoggedOn.vbs
at the command line while in the directory where the file
is located. A small window will open prompting you for the name
of the computer to query.
You will see the logged on user displayed in a small Windows Script Host window as shown below:
If no one is logged on to the system, you will see "null" displayed in the small Windows Script Host window that opens.
If you want the logged on user information displayed in a form
that you can copy and paste into a document, you can use
cscript /nologo LoggedOn
instead. The results will
then be displayed on the command line as below:
C:\Program Files\Utilities\Miscellaneous>cscript /nologo LoggedOn.vbs
solutions\pam
If no one is logged into the system, you will see "null" displayed on the command line.
C:\Program Files\Utilities\Miscellaneous>cscript /nologo LoggedOn.vbs
null
If the system can't be queried, you won't see an error message. Instead, you won't see anything displayed.
Information on other utilities to display the logged on user can be found at Who Is Logged On?.
References:
-
List User Logged On To A Remote Computer
By Cheyenne Harden
LazyNetworkAdmin.com -
Who Is Logged On?
MoonPoint Support