Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Set-Acl permission failed

$
0
0

I am trying to set the permissions on a folder using the below code, However i get this error :-

Cannot find an overload for "FileSystemAccessRule" and the argument count: "6".



Functin kozos_Permission($Server)
{

 $FolderLocation = "C:\inetpub\ftproot\kozos"
 $GroupToBeAdded = "$Server\administrators"
 $acl = Get-Acl -Path $FolderLocation
 $User = [System.Security.Principal.NTAccount]$GroupToBeAdded
 $AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($User, "FullControl","ContainerInherit", "ObjectInherit", "None", "Allow")
 $acl.AddAccessRule($AccessRule)
 set-acl -Path $FolderLocation -AclObject $acl
}
kozos_Permission localhost


Viewing all articles
Browse latest Browse all 21975

Trending Articles



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