'==========================================================================
'
'
' NAME: <listName_Only_AllShares.vbs>
'
' AUTHOR: Ed Wilson , MS
' DATE  : 5/7/2006
'ver.1.1 Made only a few changes
' COMMENT: <uses Win32_share object
' uses select name to return name properties
' uses for next to iterate through the collection>
'
'==========================================================================

Option Explicit 
On Error Resume Next
dim strComputer
dim wmiNS
dim wmiQuery
dim objWMIService
dim colItems
dim objItem

strComputer = "."
wmiNS = "\root\cimv2"
wmiQuery = "Select Name from win32_Share"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & wmiNS)
Set colItems = objWMIService.ExecQuery(wmiQuery)

For Each objItem In colItems
    WScript.Echo "Name: " & objItem.Name
Next