carbonbase
asked on
How to modify existing CIFS share permissions
I would like to modify permissions on a number of NetApp CIFS shares (over 100). These are user shares and each share has a different user account with "Change" share permission, this permission now needs to be "Full Control".
I also need to be able to add a new group to these shares and give that group "Full Control" and finally I need to remove a group "Domain Admins" that has already been given permissions to the shares.
So far I've only worked out how to view the share permissions:
Get-NaCifsShareAcl -Share usrtest01 | select ShareName -ExpandProperty UserAclInfo
I also need to be able to add a new group to these shares and give that group "Full Control" and finally I need to remove a group "Domain Admins" that has already been given permissions to the shares.
So far I've only worked out how to view the share permissions:
Get-NaCifsShareAcl -Share usrtest01 | select ShareName -ExpandProperty UserAclInfo
ASKER
I'm trying to modify share permissions, I believe icacls works with NTFS permissions
ASKER
What I have at the moment is this...
share name: abc1
permission 1: mydomain\user 1 change
permission 2: mydomain\domain admins full control
share name: abc2
permission 1: mydomain\user 2 change
permission 2: mydomain\domain admins full control
What I want to end up with is this....
share name: abc1
permission 1: mydomain\user 1 full control
permission 2: mydomain\new group full control
share name: abc2
permission 1: mydomain\user 2 full control
permission 2: mydomain\new group full control
I think maybe the easiest way to get what I want would be to enumerate the share permissions and for any user account that is not Domain Admins, change its share permission to "full control" then remove Domain Admins and add my new group giving it "full control" as well. But if anyone has any better ideas please let me know
share name: abc1
permission 1: mydomain\user 1 change
permission 2: mydomain\domain admins full control
share name: abc2
permission 1: mydomain\user 2 change
permission 2: mydomain\domain admins full control
What I want to end up with is this....
share name: abc1
permission 1: mydomain\user 1 full control
permission 2: mydomain\new group full control
share name: abc2
permission 1: mydomain\user 2 full control
permission 2: mydomain\new group full control
I think maybe the easiest way to get what I want would be to enumerate the share permissions and for any user account that is not Domain Admins, change its share permission to "full control" then remove Domain Admins and add my new group giving it "full control" as well. But if anyone has any better ideas please let me know
You could use Set-NaCifsShareAcl & Remove-NaCifsShareAcl cmdlets to modify permissions.. For the bulk modification do you want it to run against all shares or for a particular list of shares?
Example..
https://communities.netapp.com/community/netapp-blogs/msenviro/blog/2011/09/28/managing-cifs-from-the-data-ontap-powershell-toolkit
Example..
Set-NaCifsShareAcl -Share abc2 -User "mydomain\new group" -AccessRights "Full Control"
Remove-NaCifsShareAcl -Share abc2 -User "mydomain\domain admins"
Here is more details..https://communities.netapp.com/community/netapp-blogs/msenviro/blog/2011/09/28/managing-cifs-from-the-data-ontap-powershell-toolkit
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks very much for this. I've added
Where-Object {$_.MountPoint -like "/vol/users"}
to your code so that only the user shares are modified.
Thanks!
Where-Object {$_.MountPoint -like "/vol/users"}
to your code so that only the user shares are modified.
Thanks!
Cheers