[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Check who currently logged into server from command line?

Posted on 2007-10-15
9
Medium Priority
?
16,916 Views
Last Modified: 2009-07-20
I am at my workstation.  The server I RDP into has all of the connections taken.  My question is this.  Is there a way to check who is currently logged into that server via my command line?
0
Comment
Question by:donnatronious
9 Comments
 
LVL 19

Assisted Solution

by:aissim
aissim earned 400 total points
ID: 20080181
This MS/Sysinternal utility may do the trick for ya:
http://www.microsoft.com/technet/sysinternals/utilities/psloggedon.mspx
0
 
LVL 70

Assisted Solution

by:KCTS
KCTS earned 400 total points
ID: 20080312
0
 
LVL 35

Accepted Solution

by:
Nirmal Sharma earned 600 total points
ID: 20080500
Run the following command from your workstation:

Psexec.exe \\computer_name cmd.exe /c SET %username% > Output.txt 2>&1

Open output.txt and look for username.

The following script lets you to save the result in a CSV format file for all computers:

@echo off
Srvlist=C:\Temp\Srvlist.txt
Echo Computer Name, Logged On User Name >> Result.csv
SET Usr_name=
For /F Tokens=* %%a In (%srvlist%) Do (
Set Comp_name=%%a
Psexec.exe \\%comp_name cmd.exe /c SET %username% > Output.txt 2>&1
For /f "Tokens=3" %%b in (Output.txt) DO SET Usr_name=%%b
Echo %Comp_name%, %Usr_name% >> Result.csv
)
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 9

Assisted Solution

by:MSE-dwells
MSE-dwells earned 600 total points
ID: 20080569
Use -

query user

... or -

query session

In addition, I recently wrote a script that destroys _INACTIVE_ sessions on Windows Terminal Servers.  It's available here you think if it will beof use -

ftp://falcon.msetechnology.com/scripts/tsdestroy.cmd.txt
0
 
LVL 35

Expert Comment

by:Nirmal Sharma
ID: 20080631
MSE - good job!
0
 
LVL 9

Expert Comment

by:MSE-dwells
ID: 20080708
Glad it helped ... feel free to comment back here if you'd like any additional (within reason ;0) features.
0
 
LVL 5

Expert Comment

by:sabk
ID: 20410476
You can also check without run batch  in command prompt type      
qwinsta /server:IPAddress or Name
0
 

Expert Comment

by:mckockiner
ID: 22964745
quser
0
 

Expert Comment

by:IvorStones
ID: 24895997
echo %userdomain%\%username%
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a little timesaver I have been using for setting up Microsoft Small Business Server (SBS) in the simplest possible way. It may not be appropriate for every customer. However, when you get a situation where the person who owns the server is i…
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question