

Now that we are done enumerating shares on a single server, we need to make sure we close our remote PowerShell session: PS> Exit-PSSession Enumerate Shares on Multiple File Servers

With this information, it is easy to tell who has full access to the share and then take steps to remove that access if it isn't appropriate for an individual or group. We might also have a time where we need to enumerate the share permissions to find out who has full access to a share: This gives us a list of the users and groups, and their current level of access to the share. It is also possible to view the share permissions for this share by switching to the get-smbshare access cmdlet. This allows us to view quite a bit of information about our share, including things like the type of share, folder enumeration mode, caching mode, and of course, our share name and path, to name a few. Now that we have our share on this server identified, it might be useful to list all of the properties for this share, especially if we are looking for specific details about our share: There, that gives us a much clearer view of the share information we are looking for. We can clean up this list by using the Special parameter and setting it to $false to specify that we do not wish to see the administrative shares: This does accomplish the task of getting a list of shares, but it is a little cluttered. This also includes the administrative shares, whose share names are appended by $. Once connected, it takes a single cmdlet to get file share information get-smbshare.Īs you can see, this gives us a list of all of the share on this server. We will accomplish this by entering into a remote PowerShell session with our file server FILE01. Let's start by connecting to a remote file server to gather this information from a single server. Feel free to have a watch or, if you prefer text, read on! Enumerate Shares on a Single File Server

This blog post has a companion video created by TechSnips contributor, David Lamb. If you're a beginner/intermediate PowerShell scripter, be sure to check out my FREE mini-course on Building a PowerShell Tool! 9,000+ words of deep explanation and insights on how to build a PowerShell tool. Thankfully, using PowerShell get-smbshare makes this task a snap, whether you need to enumerate shares on just one server, or many. Adding to the tedium is remotely connecting to each server to find the list the shares. This becomes even more difficult if you have to track this information across multiple servers. It can be challenging to keep track of just what file shares have been set up in your environment. Be sure to also check out more how-to posts on cloud computing, system administration, IT, and DevOps on ! If you'd like to read more from this author, check out his ATA author page.
