Error DataBase-One Place all Solutions Forums Blog Glossary    Contact Us
Search  
   
Browse by Category
Error DataBase-One Place all Solutions .: Operating Systems .: Windows Operating Systems .: Windows Scripts and Batch Files .: VBScript to List Network Shares

VBScript to List Network Shares

This script will interrogate the operating system and then echo each share to a message box.  There is one pre-requisite.  Naturally, you must have a shared folder or printer on the machine that you run the script.

Instructions for displaying a servers shares

  1. Copy and paste the script below into notepad.
  2. Change the name of GuyServer on Line 11.  Set the strServer to the name of your computer.
  3. Save the file with a .vbs extension e.g. ListShare .vbs.
  4. Double click the script, then read the names of the shares in the message box.
  5.  

    ' ListShare.vbs Windows Logon Script
    ' VBScript List Shares on a Server
    ' Author Guy Thomas http://computerperformance.co.uk/
    ' Ezine 75 Version 1.3 - May 2005
    ' ----------------------------------------------------'
    Option Explicit
    Dim objFs, objShare
    Dim strServer

    ' The section sets the variables
    strServer = "GuyServer"

    ' Connects to the operating system's file system
    set objFs = GetObject("WinNT://" _
    & strServer & "/LanmanServer,FileService")

    ' Loops through each share
    For Each objShare In objFs
    WScript.Echo objShare.name
    Next

    End of List Share VBScript


How helpful was this article to you?

Related Articles

article VBScript to List Network Shares with InputBox
Instructions for displaying a list of a...

(No rating)  5-1-2008    Views: 119   
article VBScript to find uptime for the list of server
On Error Resume NextConst...

(No rating)  5-5-2008    Views: 175   
article VBScript to Change Admin Password on a list of Computers
Create a text file listing one computer...

(No rating)  5-2-2008    Views: 141   

User Comments

Add Comment
No comments have been posted.