70

If I have a Windows server (typically 2000, 2003 or 2008), is there a simple way to list all local directories shared on that server?

I can find the shares themselves easily enough, but I would love a quick way to find the local directories they represent on disk.

Thanks!

Rune Jacobsen
  • 805
  • 1
  • 6
  • 6

9 Answers9

95

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.
SHernandez
  • 127
  • 4
Sam Cogan
  • 38,158
  • 6
  • 77
  • 113
  • 3
    This is misleading; while the GUI solution works, when going CLI `net share` should be used to show what is shared on the local server and the corresponding physical paths (which `net view` doesn't show). – Massimo Dec 30 '15 at 15:50
  • 1
    @Massimo your comment is misleading. My suggestion was to use Net View for listing remote shares. Net Share will not list remote shares and so cannot be used for this. If you are looking at the local machine then yes, Net Share is a better option, but it is not available remotely. – Sam Cogan Jan 04 '16 at 13:25
  • @Sam The question says nothing about remote servers, it asks for a way to "list all local directories shared on that server" and "the local directories they represent on disk". `net view` doesn't show the physical paths, `net share` does. And sure, it doesn't work remotely, but it wasn't asked to do so. – Massimo Jan 04 '16 at 13:56
35

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.

Benoit
  • 3,499
  • 1
  • 18
  • 17
22

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.

ThatGraemeGuy
  • 15,314
  • 12
  • 51
  • 78
17

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.

Richard
  • 5,309
  • 1
  • 22
  • 20
  • 2
    to get this from a computer other than the one you are on add "-computername name" to the command. This can be real handy if you want to get the shares across a whole host of machines. Don't forget you can dump them into a csv for further processing and lots of other fun PowerShell goodness. – flickerfly Dec 26 '12 at 16:54
12

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.

Bil Simser
  • 221
  • 2
  • 3
7

For a quick-and-dirty list, from a command-prompt execute "NET SHARE". The only problem with this command is that it thoughtfully formats data into columns and potentially cuts off long paths.

You may be better served by doing at

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanmanServer\Shares

with REGEDIT. You can export this as-desired.

Evan Anderson
  • 141,071
  • 19
  • 191
  • 328
4

Right click on your My Computer icon and choose Manage.

In the window that opens, look in the tree on the left for the icon labeled Shared Folders and expand it to find another icon labeled Shares. Click here and you should see a list of all current shares.

Joel Coel
  • 12,910
  • 13
  • 61
  • 99
0

Open a PowerShell instance, add this function, then run it:

function Get-FileShare {
    [CmdletBinding()]
    param(
        [string] $Name = '%',

        [parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
        [string] $ComputerName = "$env:COMPUTERNAME"
    )
    Set-StrictMode -Version Latest

    $Name = $Name -replace "\*", "%"

    if ($Name -eq '%') {
        Get-WmiObject -Class Win32_Share -ComputerName $ComputerName
    }
    else {
        Get-WmiObject -Class Win32_Share -ComputerName $ComputerName -Filter "Name LIKE '$Name'"
    }
}
doer
  • 109
-1

\servername write the name of server on your computer in Run (window+R) then its show list of share folder give by serve

Hawraz Abdulla

  • 1
    This is neither correct (**\\**SERVER instead of \SERVER) nor an answer.Windows Explorer list not *local* shares but *remote* shares and is even excluding names with $ in it. Additionally it's no a list but a display window. – bjoster Apr 10 '19 at 12:49