dimanche 12 avril 2015

Set "Share Permissions" for a UNC path using Powershell

I currently have the following code to attempt to setup Windows share permissions for a UNC path.



$actualFolderPath = '\\mydc\sharing'
$Acl = Get-Acl $actualFolderPath

$Ar = New-Object System.Security.AccessControl.FileSystemAccessRule('mydc\userA', "FullControl","Allow")

$Acl.AddAccessRule($Ar)
Set-Acl $actualFolderPath $Acl
Get-Acl $actualFolderPath


But it isn't working - when I right click that share folder and go to Properties window's Sharing tab, in the Advanced Sharing's Permissions window, it is fully blank.


Aucun commentaire:

Enregistrer un commentaire