Hello,

I need to search for 'Everyone' and 'Authenticated Users' permissions on
every network shares from about 100 Windows Server 2003 servers we have and,
then, list only the network shares that have such permissions. Do you know
any effective tool or script to get this? I tried shareenum but it is not
useful to scan a specified group of servers.

Any input would be apreciated.

Thank you!

Re: Searching Network Share Permissions by Pegasus

Pegasus
Fri May 02 17:42:54 CDT 2008


"Blosjos" <Blosjos@discussions.microsoft.com> wrote in message
news:85620FD1-A9AE-48C1-A2CD-091A385E7ECB@microsoft.com...
> Hello,
>
> I need to search for 'Everyone' and 'Authenticated Users' permissions on
> every network shares from about 100 Windows Server 2003 servers we have
> and,
> then, list only the network shares that have such permissions. Do you know
> any effective tool or script to get this? I tried shareenum but it is not
> useful to scan a specified group of servers.
>
> Any input would be apreciated.
>
> Thank you!

You could use this script:
01. const PCList = "c:\temp\PCs.txt"
02. Const Group1 = "EVERYONE" 'Must be upper case!
03. Const Group2 = "AUTHENTICATED USERS"
04.
05. Set objWshShell = CreateObject("WScript.Shell")
06. Set objFSO = CreateObject("Scripting.FileSystemObject")
07. Set objFile = objFSO.OpenTextFile(PCList)
08. While Not objFile.AtEndOfStream
09. CheckShares objFile.ReadLine
10. Wend
11. objFile.Close
12.
13. Sub CheckShares(strComputer)
14. Set ObjExec = objWshShell.Exec("srvcheck.exe \\" & strComputer)
15.
16. Do While Not ObjExec.StdOut.AtEndOfStream
17. Line = UCase(ObjExec.StdOut.ReadLine)
18. If InStr(Line, "BAD COMPUTERNAME") > 0 Then
19. WScript.echo strComputer & " is unreachable"
20. Exit Sub
21. End If
22.
23. If Trim(Line) <> "" Then
24. If Left(Line, 2) = "\\" Then
25. Name = Line
26. Else
27. If InStr(line, Group1) > 0 Then WScript.Echo "Share=" & Name & ": "
& Group1
28. If InStr(line, Group2) > 0 Then WScript.Echo "Share=" & Name & ": "
& Group2
29. End If
30. End If
31. Loop
32. End Sub

To make it work you must store a list of your servers in
c:\temp\PCs.txt, e.g. like so:
Server1
Server2
The script expects srvcheck.exe to be in the path. You can
download it from the Windows Resource Kit. Unfortunately
it lists both file and printer shares.



Re: Searching Network Share Permissions by Blosjos

Blosjos
Fri May 02 18:53:00 CDT 2008

Thank you very much for your quick answer! :-) Would it be possible also to
show the share permission along with everyone or authenticated users. Eg:
\\server1\share: Everyone Full Control
\\server2\share2: Everyone Modify
\\server3\share3: Everyone Read

Thank you very much!

"Pegasus (MVP)" wrote:

>
> "Blosjos" <Blosjos@discussions.microsoft.com> wrote in message
> news:85620FD1-A9AE-48C1-A2CD-091A385E7ECB@microsoft.com...
> > Hello,
> >
> > I need to search for 'Everyone' and 'Authenticated Users' permissions on
> > every network shares from about 100 Windows Server 2003 servers we have
> > and,
> > then, list only the network shares that have such permissions. Do you know
> > any effective tool or script to get this? I tried shareenum but it is not
> > useful to scan a specified group of servers.
> >
> > Any input would be apreciated.
> >
> > Thank you!
>
> You could use this script:
> 01. const PCList = "c:\temp\PCs.txt"
> 02. Const Group1 = "EVERYONE" 'Must be upper case!
> 03. Const Group2 = "AUTHENTICATED USERS"
> 04.
> 05. Set objWshShell = CreateObject("WScript.Shell")
> 06. Set objFSO = CreateObject("Scripting.FileSystemObject")
> 07. Set objFile = objFSO.OpenTextFile(PCList)
> 08. While Not objFile.AtEndOfStream
> 09. CheckShares objFile.ReadLine
> 10. Wend
> 11. objFile.Close
> 12.
> 13. Sub CheckShares(strComputer)
> 14. Set ObjExec = objWshShell.Exec("srvcheck.exe \\" & strComputer)
> 15.
> 16. Do While Not ObjExec.StdOut.AtEndOfStream
> 17. Line = UCase(ObjExec.StdOut.ReadLine)
> 18. If InStr(Line, "BAD COMPUTERNAME") > 0 Then
> 19. WScript.echo strComputer & " is unreachable"
> 20. Exit Sub
> 21. End If
> 22.
> 23. If Trim(Line) <> "" Then
> 24. If Left(Line, 2) = "\\" Then
> 25. Name = Line
> 26. Else
> 27. If InStr(line, Group1) > 0 Then WScript.Echo "Share=" & Name & ": "
> & Group1
> 28. If InStr(line, Group2) > 0 Then WScript.Echo "Share=" & Name & ": "
> & Group2
> 29. End If
> 30. End If
> 31. Loop
> 32. End Sub
>
> To make it work you must store a list of your servers in
> c:\temp\PCs.txt, e.g. like so:
> Server1
> Server2
> The script expects srvcheck.exe to be in the path. You can
> download it from the Windows Resource Kit. Unfortunately
> it lists both file and printer shares.
>
>
>

Re: Searching Network Share Permissions by Pegasus

Pegasus
Sat May 03 07:41:56 CDT 2008


"Blosjos" <Blosjos@discussions.microsoft.com> wrote in message
news:5BE77421-15CF-4FD3-8E66-3632A346F316@microsoft.com...
> Thank you very much for your quick answer! :-) Would it be possible also
> to
> show the share permission along with everyone or authenticated users. Eg:
> \\server1\share: Everyone Full Control
> \\server2\share2: Everyone Modify
> \\server3\share3: Everyone Read
>
> Thank you very much!
>

Try this:
01. const PCList = "c:\temp\PCs.txt"
02. Const Group1 = "EVERYONE" 'Must be upper case!
03. Const Group2 = "AUTHENTICATED USERS"
04.
05. Set objWshShell = CreateObject("WScript.Shell")
06. Set objFSO = CreateObject("Scripting.FileSystemObject")
07. Set objFile = objFSO.OpenTextFile(PCList)
08. While Not objFile.AtEndOfStream
09. CheckShares objFile.ReadLine
10. Wend
11. objFile.Close
12.
13. Sub CheckShares(strComputer)
14. Set ObjExec = objWshShell.Exec("srvcheck.exe \\" & strComputer)
15.
16. Do While Not ObjExec.StdOut.AtEndOfStream
17. Line = UCase(ObjExec.StdOut.ReadLine)
18. If InStr(Line, "BAD COMPUTERNAME") > 0 Then
19. WScript.echo strComputer & " is unreachable"
20. Exit Sub
21. End If
22.
23. If Trim(Line) <> "" Then
24. If Left(Line, 2) = "\\" Then
25. Name = Line
26. Else
27. If InStr(line, Group1) > 0 Then WScript.Echo "Share=" & Name & ": "
& Line
28. If InStr(line, Group2) > 0 Then WScript.Echo "Share=" & Name & ": "
& Line
29. End If
30. End If
31. Loop
32. End Sub