Gearbox
Gearbox

Reputation: 336

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.

Upvotes: 0

Views: 947

Answers (1)

Trey Nuckolls
Trey Nuckolls

Reputation: 591

I think this affects the NTFS permissions and not the share permissions. I think command to affect the share permissions would be Revoke-SmbShareAccess and Grant-SmbShareAccess

Upvotes: 1

Related Questions