How can I get a list of shared directories on local Windows server?

Solution 1:

You can go into computer management (right click my computer, select manage), expand the Shared Folders node and see a list of all shares, connected sessions and open files.

For W2K8, you do this in Server Manager instead: Roles -> File Services -> Share and Storage Management; the Shares tab in the center of the window.

For listing shares of remote servers, note that NET VIEW svr_name will only show user shares, no admin or hidden shares. Adding the /all switch at the end will show these others (for W2K8).

C:\>net view sx1
Shared resources at sx1

Share name    Type  Used as  Comment
 --------------------------------------------
SHARE_CIFS    Disk
The command completed successfully.

C:\>net view sx1 /all
Shared resources at sx1

Share name    Type  Used as  Comment
 --------------------------------------------
ADMIN$        Disk           Remote Admin
SHARE_CIFS    Disk
C$            Disk           Default share
IPC$          IPC            Remote IPC
The command completed successfully.

Solution 2:

From a command line prompt, you can use the "net share" command. It will print a table with the list of the share name, the resource and an optional remark.


Solution 3:

net share from a command prompt will give you the share name and path. If you need something more advanced, you could query WMI using VBScript or PowerShell.


Solution 4:

Use WMI: Win32_Share.

In PowerShell:

gwmi -class Win32_Share

This also includes the system provided shares and will work remotely.

THe resulting object's Path property is the local path.


Solution 5:

For some clarity (as it's not obvious where to find the list of shares in the GUI)

As people mentioned, open a command prompt and type net share. This is probably the easiest way to see what shares are available. This will also show hidden shares (those with $ as the suffix) and where the share points to.

Here's an example:

C:\Users\tstmoss>net share

Share name   Resource                        Remark
-------------------------------------------------------------------------------
C$           C:\                             Default share
IPC$                                         Remote IPC
ADMIN$       C:\Windows                      Remote Admin
The command completed successfully.

On Windows Server 2008 either right click on Computer in the Start menu and select Manage, or launch the Server Manager (by default, the first icon next to the start menu in the task bar).

In the Server Manager, expand the Roles node, then expand the File Services node. Click on Share and Storage Management. The display will show two tabs, Shares and Volumes. The Shares tab shows you the existing shares (same as the console output above). This interface does allow you to interact with the with the share like changing properties/permissions, stopping the share, or creating new ones.

Hope that helps.