How to display currently connected users/workstations to a Windows SMB Share?
From a command prompt run net session
. That will show you session connection information. It will not show you who is actively transferring data. For that you'll need to run a packet capture program on the server.
You could also run the MMC console relative to the Windows OS and Role for File sharing (Share and Storage Management in Windows Server 2008 R2 for instance). For instance, On Windows Server 2008 and 2008 R2 you could open the Computer Management console and navigate to File Services|Share and Storage Management
and click the Manage Sessions
item or the Manage Open Files
item in the Action Pane.
There are two basic ways to see which files on SMB shares are being accessed:
-
[CLI] The
openfiles
command. -
[GUI] The
Open Files
object underComputer Management
(compmgmt.msc
) =>Shared Folders
=>Open Files
.
Any file that is currently open should be considered to be potentially in use, either being read, written to, or simply held open by a process on a client computer.
These will also show you which user (or computer, if there's no user associated with it) owns the handle. Otherwise, see joeqwerty's answer for how to grab just a list of active SMB sessions/users.