How do I get a list of all shared folders from all servers?

green

This script will, unaltered, find all servers in Active Directory and probe each for its shared folders (using WMI).  It is set to automatically exclude the default shares lik SYSVOL, system drive shares (C$, D$ etc), printer shares and others.

 

 

The result should list each server name, with a list of shares names and local drive locations of those shares:

shares

green

2 Comments How do I get a list of all shared folders from all servers?

  1. Bradford

    I changed ($share.name -notmatch “.\$”) to ($share.name -notmatch “^.\$”) because it was matching on all hidden shares instead of just the admin drive shares.
    Also, there’s another print share: ($share.name -ne “prnproc$”)

    Final statement:
    if (($share.name -ne “print$”) -and ($share.name -ne “prnproc$”) -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$”))

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *