Create Share Folder and Set ACP Permission

New Contributor

Hi Everyone, Actually I am looking for a script to do the following in result: 1- Create and Share Folder as the following permission: A\Authenticated Users: Read 2-Disable Inheritance from upper folder (root folder) 3-Add Description (in the comments): This folder to be used via user1 3- Set ACl Permission as the following (Domain a.com): A\SG1: Full Control, A\SG2: Full Control, SYSTEM: Full Control, A\SG3: Read, A\SG4: List Folder Contents, A\SG5: Write, A\user1: Modify 4- the Set Share & ACL is inherited on the Subfolders and files where: SG1, SG2, SG3, SG4, SG5 are Domain Security Groups and user1 is a domain user Actually, I found some scripts but not to grant multiple SG access on the share folder. Thanks

2 Replies

Hi @Aamironit 

 

 

 

mkdir E:\testing\
New-SmbShare -Name "Shared Folder" -Path "E:\Testing\" -FullAccess "Contoso\Jeff","Contoso\Joe"

   [-FullAccess <String[]>]
   [-ChangeAccess <String[]>]
   [-ReadAccess <String[]>]
   [-NoAccess <String[]>]

 

 

Check out the official documentation.

https://docs.microsoft.com/en-us/powershell/module/smbshare/new-smbshare?view=windowsserver2022-ps

I would love, if you don't "order" a script, but you share some code that you already made :)

 

Best regards,
Schnittlauch

"First, No system is safe. Second, Aim for the impossible. Third, no Backup, no Mercy" - Schnittlauch

My answer helped you? Don't forget to leave a like. Also mark the answer as solved when your problem is solved. :)

@Schnittlauch 

 

 

Thanks a lot, Actually I already seen this code to give full permission for one object user/group, but my point is I did not get how to set for more than user/group, if it is needed to be pipeline or how it is connected to be run all at one time. 

 

 

Thanks