I am currently trying to add a group called "Domain Admins" to all fileshares, we have over 300. I would like to automate this so I don't have to do this manually for each one, and would then like to remove the local administrator group from each fileshare as well.
I currently am able to get all fileshares names and permissions of each one with:
$shares = Get-SmbShare
foreach($share in $shares) {
$share
(get-smbshare $share.Path)| select @{Label="Path"; Expression = { Convert-Path $_.Path }} -ExpandProperty Access
}
But I can't seem to find any resources that demonstrate how to add a group to all fileshares. I know how to add a group to a specific file share, but not all. If anyone can share some tips, that would be great!