hi

i have been using the below script (hobbled together by other peoples work, not mine)

and it would be perfect if i could extend it to only show shares that have used Everyone to assign rights

any ideas ?

mal

# Add powershell modules for Active Directory
import-module activedirectory;

# Get list of servers from Active Directory
$servers = get-adcomputer -filter {operatingsystem -like "*server*"} | where {$_.enabled -eq $true};

# Loop through each server found
foreach ($server in $servers) {

    # Check if server can be pinged
    if(test-connection -cn $server.name -quiet -count 1) {

    # Output to screen the name of the server
    write-host "-------------";
    write-host $server.name;
    write-host "-------------";

    # Get the list of shared folders
    $shares = gwmi win32_share -computer $server.name;

    # Loop through each shared folder found
    foreach ($share in $shares) {

        # Exclude default drive shares, other system default shares and printers
        if (($share.name -ne "print$") -and ($share.path -notlike "*LocalsplOnly*") -and ($share.name -notmatch ".\$") -and ($share.name -ne "ipc$") -and ($share.name -ne "sysvol") -and ($share.name -ne "netlogon")-and ($share.name -ne "admin$")) {

            # Output to screen the name and path of the shared folder
          # write-host $share.name $share.path;
  $out = $server.name + "," + $share.name + "," + $share.path
  $out >> C:\reports\shares.csv
            }

        }

    write-host "";

    }
}
5 Spice ups

Welcome

If you post code, please use the ‘Insert Code’ button. Please and thank you!

192033ab-bb8f-4032-88a5-8e2313af0344-codebutton_small.png

2 Spice ups

For each share, you can get the share’s access using Get-SmbShareAccess.

You can find the shares which have an everyone ACE like this:

Get-SmbShare | Get-SmbShareAccess | Where-Object name -match 'everyone'

NB - on my hosts I get nothing but I have nothing shared to everyone.