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
carbonbaseAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Emmanuel AdebayoGlobal Windows Infrastructure Engineer - ConsultantCommented:
Have you tried to use icacls

Cheers
0
carbonbaseAuthor Commented:
I'm trying to modify share permissions, I believe icacls works with NTFS permissions
0
carbonbaseAuthor Commented:
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
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

SubsunCommented:
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..
Set-NaCifsShareAcl -Share abc2 -User "mydomain\new group" -AccessRights "Full Control"

Remove-NaCifsShareAcl -Share abc2 -User "mydomain\domain admins"

Open in new window

Here is more details..
https://communities.netapp.com/community/netapp-blogs/msenviro/blog/2011/09/28/managing-cifs-from-the-data-ontap-powershell-toolkit
0
SubsunCommented:
Here is a sample code which comp through all shares and make required changes and save the report to a csv file..
Connect-nacontroller "ControllerName"

Get-NaCifsShareAcl | select ShareName -ExpandProperty UserAclInfo | % {
$AccessRights = $_.AccessRights;$ShareName = $_.ShareName;$UserName = $_.UserName

Write-Host "Working on $ShareName"
	If ($AccessRights -eq "change"){
	Try{
	#Set the AccessRights to Full Control
	Set-NaCifsShareAcl -Share $ShareName -User $UserName -AccessRights "Full Control" -ErrorAction Stop
		 New-Object PSobject -Property @{ShareName = $ShareName;UserName = $UserName;AccessRights = "Updated"}
	}Catch{
	 New-Object PSobject -Property @{ShareName = $ShareName;UserName = $UserName;AccessRights = "Not Updated"}
	}
	}
	
	If ($UserName -eq "mydomain\domain admins"){
	Try{
	#Remove the mydomain\domain admins permission from share
	Remove-NaCifsShareAcl -Share $ShareName -User "mydomain\domain admins" -ErrorAction Stop
		 New-Object PSobject -Property @{ShareName = $ShareName;UserName = $UserName;AccessRights = "Updated"}
	}Catch{
	 New-Object PSobject -Property @{ShareName = $ShareName;UserName = $UserName;AccessRights = "Not Updated"}
	}
	}
}| Select ShareName,UserName,AccessRights | Export-Csv C:\Test\Report.csv -nti

Open in new window

PS : Test the code thoroughly in lab before run it in production..
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
carbonbaseAuthor Commented:
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!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Storage

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.