List Shared Folders Permissions in PowerShell
In some cases, such as file server migration, you may want to output a list of paths and permissions for Windows Shared Folders.This article introduces how to check them with Powershell.
*In general, access control is set to Everyone
/Full control
in the Shared Folder Permissions, is often finely controlled by NTFS Permissions.
Check Shared Folder Paths
The path to the shared folder can be found with Get-SmbShare
.
1PS C:\> Get-SmbShare
2
3Name ScopeName Path Description
4---- --------- ---- -----------
5ADMIN$ * C:\WINDOWS Remote Admin
6C$ * C:\ Default share
7IPC$ * Remote IPC
8Share * D:\Share
9Share2 * D:\Share2
Use the -Special $false
option to hide Admin share and IPC$ share.
1PS C:\> Get-SmbShare -Special $false
2
3Name ScopeName Path Description
4---- --------- ---- -----------
5Share * D:\Share
6Share2 * D:\Share2
List Shared Folders Permissions
Use Get-SmbShare
and Get-SmbShareAccess
to list Shared Folder Permissions.
1PS C:\> Get-SmbShare -Special $false | ForEach-Object { Get-SmbShareAccess $_.Name }
2
3Name ScopeName AccountName AccessControlType AccessRight
4---- --------- ----------- ----------------- -----------
5Share * Everyone Allow Full
6Share2 * Everyone Allow Full
Summary
If you have many shared folders on your file server, you can easily check them with the commands presented here.