Pull special permission entries from advanced security settings for share folders

hello all,

I am trying to pull the permissions entries listed in advanced security settings for all folders in D drive of the server that I am running the script.
Usually in GUI:
Open D drive
Select Folder
Open Properties
Go to security Tab (no need to pull the security groups or users from this)
click advanced
go to share tab

It shows permission entries, which I see is different from the one’s mentioned in Security tab, can someone please help me how can I start working using script, which command can help me start scripting this?

Need help pls… Thaks

Have you tried to search for it at least once? What you asked for is a very common task and has been asked and answered a lot of times already.

If you don’t know how to search you may simply use the subject you used for this question and add “PowerShell” to it before you paste it to the search bar of Google/Bing/Ecosia or whatever. :man_shrugging:t3:

Hello Rahul,

Yes, there are 2 layers of security.

  • The CIFS shared layer
  • The file system ACL layer

When configuring a share, you need to look into those two.
Here are the commands related to each of the above

  • Get-SmbShare and Get-SmbShareAccess
    • Are the commands to look/change shared folders
  • get-ACL and Set-ACL
    • Will show you local ACL on the file system
  • $AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule…
    • Is also a key word to create new ACL using Set-ACL

I will let you search for examples on internet to find example of implementation

@Olaf I had tried searching on internet, It all shows the get-acl and get-smbshare.
Get-acl is only listing the security users or groups of folder properties but not listing advanced special permissions. For few folders I see the one listed in Security tab and the one listed in share tab of advanced permissions of a foder are different

thanks for your quick response @ZaMotH

SMB commands aren’t working on the server.
But ACL command is only listing the groups or users from security tab groups or users but I need the pricipal permission entries of share tab of advanced security settings of folder.

Can you pls help, I’m struck

I have. I don’t know why they are not working (did you run as administrator ?). Unfortunately, this is something you will have to find by yourself.

You might need this module:

From there, have a look at: