21

On my windows 2008 server I have a network share. I am logged on to the server with full administrator rights. I would like to know what users have active connections to that share.

How do I find that information?

Mark Arnott
  • 972
  • 4
  • 10
  • 18

4 Answers4

29

There are two ways to go about this that I know if. One is unreliable, but probably good enough for most scenarios. One is extensive, but hard to implement at any scale that exceeds a handful of user connections.

The Kinda-Sorta Way: Select System Tools >> Shared Folders >> Open Files to see what files are open on the file server. From there you can correlate the user accounts that have open files to the shares that they are connected to.

However, that can be insufficient. Don't believe me? Go into Computer Management and select System Tools >> Shared Folders >> Sessions to see who is connected. Then look at the # open files column. Some sessions should have 0 open files. How do you know what share they are technically connected to? I'm glad you asked...

The Extensive but Hard to Scale Way: Perform net share [sharename] on each share in question to get a list of the users that are connected to it. In my testing, even users that have no open file are listed.

You can also utilize the Share and Storage Manager administrative tool in Server 2008 and beyond instead of Computer Management. Find the share in the list of shares, and then in the action pane to the right click "Manage Sessions." You will see a list of sessions including those that have zero open files.

But... but... I want to find a specific user without querying each share! If you have a specific user that you want to track down, it appears that your only means of finding that information is to query each share and eyeball it to find the user you want. And by eyeball I mean piping output to findstr or select-string. One could extrapolate the workflow to a script that enumerates all available shares, queries for connected users, and searches the output for the user in question, but that appears to be an exercise for the reader and not something that Microsoft has included as a native feature.

Wesley
  • 32,320
  • 9
  • 80
  • 116
  • Or, from a command line: NET SHARE – Simon Catlin May 27 '13 at 20:11
  • @SimonCatlin Just tested this on a Server 2008 machine. I had one user with no open files but was listed as an open session. I had to query each of the shares on the server with `net share sharename` but eventually found the share that the session was connected to. I don't know if one can reverse the query and start with the user you're interested in and then track it to the share they have a connection to. Might need some custom PowerShelling. – Wesley May 27 '13 at 20:19
  • The info provided isn't sufficient in sessions or shares. It does not show specifically which users are connected to what share. I often see multiple connections to a network share, but If a user does not have a file open than I can't tell who is connected. I can only tell that there are a certain number of connections open. Not who's got the connection open. So Rick is just plain correct in this case. –  May 27 '13 at 18:25
  • I see the specific situation that could exist, where a user has an open session, but no open file, therefore you're not sure what specific share they have a ghostly session open to. In that scenario, I don't know how to tie 0-file sessions to the share that they are connected to. – Wesley May 27 '13 at 20:06
6

This is a very old question, but the accepted answer skipped over one of the best ways to find the info. The GUI can show there are "connected clients" but not show those connections under "open files". In that case it requires using WMI to find who is connected to a share.

Here's the powershell command to see who is connected to a specific share and example output:

Get-WmiObject Win32_ServerConnection -ComputerName SERVER01 | Select-Object ShareName,UserName,ComputerName | Where-Object {$_.ShareName -eq "SHARENAME"}

Example output:

ShareName        UserName        ComputerName
---------        --------        ------------
SHARENAME        user1           10.0.0.20
SHARENAME        user2           10.0.0.30
SHARENAME        user3           10.0.0.40
Brady Witbeck
  • 61
  • 1
  • 1
  • Mad kudos I had two shares with different names to the same local path & this was the only thing that allowed me to narrow down the users & PC's using one of the two shares that I wanted to get rid of :) – gregg Apr 02 '18 at 19:24
0

Computer Manager isn't accessed the same way as in previous versions. You do get the "Server Manager" when you right click Computer and select "manage". So, instead of that, just type in compmgmt.msc in the "search programs and files" field under start.

Guest
  • 1
-3

I do not think the answer(s) provided actually answers the question. If you are using Windows Server 2008 (NOT R2), and you right-click Computer and select Manage, then confirming the UAC message, the Server Manager MMC launches. Under Server Manager are the following items: Roles, Features, Diagnostics, Configuration and Storage. None of those five items seems to have share name connections available as an option, which is what the original question was asking. The EDIT addition to the answer was more useful, mentioning the Share and Storage Manager, but still does not seem to provide the answer. It provides a comprehensive list of share names and properties, but active connections does not show up here either. With Windows Server 2003, there used to be an OS utility which displayed servers, shares and connections, but I have not found it yet on WS2008. There was a third party utility I used to use named Hyena from Adkins Resource, which I believe is still being marketed, which did an excellent job of displaying all manner of information about virtually every aspect of a server's condition.

  • 2
    You're just plain wrong. I just fired up a 2008 R2 VM. When you open Computer Management `(compmgmt.msc)` and everything that Wesley describes is right there, just the same as 2003, including open files and active sessions. [See this screenshot](http://i.imgur.com/L5oWps1.png) if you don't believe me. – MDMarra Jan 31 '13 at 03:31
  • @Rick You're right, my answer wasn't completely correct. Two years later, and at the spurring of another member who called me out, I've re-done my answer to make it right. Thanks for keeping me sharp. =) – Wesley May 27 '13 at 20:30