Instructions for displaying a list of a Computers shared drives
- Copy and paste the script below into notepad.
- Save the file with a .vbs extension e.g. ListShare2.vbs.
- Double click, enter the name of the server in the dialog box, then read the names of the shares in the message box.
' ListShare2.vbs Windows Logon Script
' VBScript List Shares on a Server
' Author Guy Thomas http://computerperformance.co.uk/
' Version 2.7 - May 2005
' ----------------------------------------------------'
Option Explicit
Dim objFs, objShare
Dim strServer, strList
' The section sets the variables
strList = " --------------------------- "
strServer = "GuyServer"
' Creates the Input Message Box
strServer = InputBox("Server to list shares: "_
," Share List", strServer)
' Connects to the operating system's file system
set objFs = GetObject("WinNT://" _
& strServer & "/LanmanServer,FileService")
' Loops through each share
For Each objShare In objFs
strList = strList & vbCr & LCase(objShare.name) _
& " " & vbTab & UCase(objShare.Description)
Next
WScript.Echo strList