How to get the Shared folder permissions with PowerShell?

PowerShellMicrosoft TechnologiesSoftware & Coding

To get the shared folder permissions using PowerShell, we can use the Get-SmbShare cmdlet.

For example, we have a shared folder name DSC and we need to retrieve its permissions, we can use the below command.


Get-SmbShare -Name DSC


Name ScopeName Path Description
---- --------- ---- -----------
DSC       *   E:\DSC

It doesn’t show the permission by default and we can retrieve the full list using Fl *. For example,

Get-SmbShare -Name DSC | fl *

And you can see the PresentPathACL property there. This property is used to retrieve the permissions on the shared folder. So we can directly use the command,


(Get-SmbShare -Name DSC).PresetPathAcl


Directory: E:\
Path Owner                   Access
---- -----                   ------
DSC BUILTIN\Administrators   Everyone Allow ReadAndExecute, Synchronize

To get the shared folder permission from the remote computer use,

Invoke-Command -ComputerName Labmachine2k16 -ScriptBlock {
   Get-SmbShare -Name DSC} | Select -ExpandProperty PresetPathAcl

Another direct command, you can use is Get-SmbShareAccess


Get-SmbShareAccess -Name "Shared folder"


PS C:\Temp> Get-SmbShareAccess -Name "Shared folder"
Name          ScopeName AccountName AccessControlType AccessRight
----          --------- ----------- ----------------- -----------
Shared folder    *       Everyone          Allow          Read
Published on 01-Mar-2021 10:14:54