' ============================================================
' GetShareReport.vbs
'
' Reports Network Shares via WMI (Win32_Share).
'
' Usage: cscript GetShareReport.vbs
' ============================================================

Option Explicit

Dim objWMIService, colItems, objItem, strOutput

Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery("SELECT Name, Path, Description, Type FROM Win32_Share")

strOutput = ""
For Each objItem In colItems
    strOutput = strOutput & "Name: " & objItem.Name & vbCrLf
    strOutput = strOutput & "Path: " & objItem.Path & vbCrLf
    strOutput = strOutput & "Description: " & objItem.Description & vbCrLf
    strOutput = strOutput & "Type: " & objItem.Type & vbCrLf
    strOutput = strOutput & String(40, "-") & vbCrLf
Next

If strOutput = "" Then
    WScript.Echo "No Network Shares found."
Else
    WScript.Echo strOutput
End If