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" $AclThanks
Sam.