Scan for shared folders on local PCs.

Dear All,

Is there anyway to scan the whole network for shared folders on local PCs?
I've looked around a bit without any luck.

Thank you for your help.
Who is Participating?
KahyakiConnect With a Mentor Commented:
Check this:

SoftPerfect Network Scanner is a free multi-threaded IP, NetBIOS and SNMP scanner with a modern interface and several advanced features. It is intended for both system administrators and general users who are interested in computer security. The program pings computers, scans for listening TCP ports and displays which types of resources are shared on the network (including system and hidden).

Easy interface and it can do the job for you I think,
At the command line try net view.
Don't think you can scan each specific shared folder.
net view is the same as viewing my network places, which is the furthest you can go.
Shift-3Connect With a Mentor Commented:
Paste the script below into a text file with a .vbs extension.  Customize the value of the strContainer variable on line 4 with the distinguished name of the OU or domain to search under.  Customize the contents of the arrExclude array on line 5 with the share names to exclude from your query.  Running the script will check each computer and write share information to a comma-delimited text file.

Const ForWriting = 2
strContainer = "ou=workstations,dc=yourdomain,dc=local"
arrExclude = Array("c$","d$","e$","f$","admin$","ipc$","print$")
strReport = "report.csv"
On Error Resume Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objReport = objFSO.OpenTextFile(strReport, ForWriting, True)
objReport.WriteLine "Computer,Share Name,Share Path,Share Description"
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = _
    "Select Name From 'LDAP://" & strContainer & "' Where objectCategory='computer'"  
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE 
Set objRecordSet = objCommand.Execute
Do Until objRecordSet.EOF
    strComputer = objRecordSet.Fields("Name").Value
    If PingCheck(strComputer, 1, 0) Then
        Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
        Set colItemList = objWMIService.ExecQuery("SELECT * FROM Win32_Share")
        For Each objItem in colItemList
            blnExcluded = False
            For Each strExclude in arrExclude
                If LCase(objItem.Name) = LCase(strExclude) Then
                    blnExcluded = True
                End If
            If Not blnExcluded Then
                objReport.WriteLine strComputer & "," & objItem.Name & "," & Chr(34) & _
                    objItem.Path & Chr(34) & ","  & Chr(34) & objItem.Description & Chr(34)
            End If
    End If
Function PingCheck(strTarget, strPings, intPause)
    Const ForReading = 1
    Set objShell = CreateObject("WScript.Shell")
    strTempDir = objShell.ExpandEnvironmentStrings("%temp%")
    strTempFile = strTempDir & "\script-" & strTarget & ".txt"
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    objShell.Run "%comspec% /c ping -n " & strPings & " -w 100 " & _
        strTarget & ">" & strTempFile, 0, True
    WScript.Sleep intPause
    objShell.Run "%comspec% /c ping -n " & strPings & " -w 100 " & _
        strTarget & ">>" & strTempFile, 0, True
    Set objTempFile = objFSO.OpenTextFile(strTempFile, ForReading)
    strOutput = objTempFile.ReadAll
    objFSO.DeleteFile strTempFile, True
    If InStr(strOutput, "bytes=32") > 0 Then
        PingCheck = True
        PingCheck = False
    End If
End Function

Open in new window

chinguettiAuthor Commented:
Thanks for your help! I went for the network scanner for it's simplicity.
Also, is there any software that can scan for local accounts?

Thank you for your help!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.