We are using sql 2008, so i can use New-smbshare also. Is there any way to do?
$acl = Get-Acl \\servername\test
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.
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..
Thanks all for your quick responses. ..
#Username/Group to give permissions to
#Securitydescriptor containting access
$share = Get-WmiObject Win32_Share -List -ComputerName $computername
You must be logged in to reply to this topic.