Hi All,
i have create a remove share using powershell and i want to enable everyone to have a “change” permission on the share i have create. I have used the below script to do so. But it is creating permission on the security no on the sharing permission.
We are using sql 2008, so i can use New-smbshare also. Is there any way to do?
Get- and Set-ACL don’t work with share permissions; they work with file permissions. That’s why this isn’t working for you. If you’re not on 2012 or later, you don’t have the SMB commands that would make this easy. I’d consider using the Cacls.exe command for this, instead.
To set permissions you need to enable both NTFS permissions and the share permissions. Your code apply the NTFS permissions.
Use the New-SmbShare cmdlet to both create the share and set the share permissions to suit your needs.
Jones, thanks for you reply. Yes i found that it won’t work with the security. I have found solutions through Win32_trustee,WInt32_ACE and WIn32_securityDescriptor to create share and share permission. Please find the below code. It worked fine for me…
#Username/Group to give permissions to
$trustee = ([wmiclass]‘Win32_trustee’).psbase.CreateInstance()
$trustee.Domain = “NT Authority”
$trustee.Name = “Everyone”