Contact Info

Crumbtrail

ActiveXperts.com » Administration » Scripts » Adsi

Map All Network Shares to Local Folders in Windows

You can use any of the VBScript programs below in ActiveXperts Network Monitor. Click here for an explanation about how to include scripts in ActiveXperts Network Monitor.

Map All Network Shares to Local Folders in Windows using VBScript, WMI and LDAP

Example(s)

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colShares = objWMIService.ExecQuery("Select * From Win32_Share")

For Each objShare in colShares
    Set colAssociations = objWMIService.ExecQuery _
        ("Associators of {Win32_Share.Name='" & objShare.Name & "'} " _
            & " Where AssocClass=Win32_ShareToDirectory")
    For Each objFolder in colAssociations
        Wscript.Echo objShare.Name & vbTab & objFolder.Name
    Next
Next