Page 1 of 1

Adding and Removing permissions from shared folder

Posted: Thu Sep 13, 2018 5:33 am
by sekou2331
I am trying to find the equivalent to the below in powershell. I see that there is a cmdlet called Get-ACL but I dont see a modifying cmdlet.

  1. for /f %%a in (servers.txt) do (
  2.  
  3. icacls \\%%a\folder /remove:g Everyone
  4.  
  5. icacls \\%%a\folder\logs /remove:g Everyone
  6.  
  7. icacls \\%%a\folder\logs /remove:g user
  8.  
  9. icacls \\%%a\folder\ /grant "Security Group":R
  10.  
  11. )
  12.  
  13.  

Re: Adding and Removing permissions from shared folder

Posted: Thu Sep 13, 2018 8:52 am
by jvierra
When you need companion CmdLets use help to find them.

help get-acl -online

The help will list the paired commands and will give you examples.

Re: Adding and Removing permissions from shared folder

Posted: Thu Sep 13, 2018 2:32 pm
by sekou2331
Ok what I am truly asking is this the right route for changing permissions on a shared folder?

Re: Adding and Removing permissions from shared folder

Posted: Thu Sep 13, 2018 2:48 pm
by jvierra
On a folder or on a share? You cannot use either to alter a share. Both only change the underlying folder.
ICACLS works correctly in PowerShell. No need to change it.