Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Set-Acl not applying permissions on folder

$
0
0

Hello,

Can anyone explain why this isn't working? I can't seem to get it working. It creates the folder, adds user, but it dosn't apply the actual permissions on the folder. I don't get any errors. Windows 7.

New-Item -type directory -path C:\MyFolder
$Control = [System.Security.AccessControl.AccessControlType]::Allow 
$Rights = [System.Security.AccessControl.FileSystemRights]"FullControl"
$User = New-Object System.Security.Principal.NTAccount("testu")
$Ar = New-Object System.Security.AccessControl.FileSystemAccessRule `
    ($User, $Rights, $Control)
$Acl = Get-Acl "C:\MyFolder"
$Acl.AddAccessRule($Ar)
Set-Acl "C:\MyFolder" $Acl

Thanks

Sam.


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>