made acl setting work

This commit is contained in:
Karl-Wilfried Zimmer 2024-07-14 21:27:44 +02:00
parent f926dfb60d
commit 5b5d72f335

View File

@ -70,14 +70,19 @@ if($PSBoundParameters.ContainsKey("ProjectName")){
$fsrr = "Read" $fsrr = "Read"
$fsrr = "Write" $fsrr = "Write"
$type = "Allow" $type = "Allow"
$fsarar = @($rid,$fsrr,$type) $fsarar = @($rid,$fsrr,,,$type)
$fsaraw = @($wid,$fsrw,$type) $fsaraw = @($wid,$fsrw,,,$type)
$fsarawr = @($wid,$fsrr,,,$type)
$fileSystemAccessRuleR = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $fsarar $fileSystemAccessRuleR = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $fsarar
$fileSystemAccessRuleW = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $fsaraw $fileSystemAccessRuleW = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $fsaraw
$fileSystemAccessRuleWR = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $fsarawr
$FolderACL.SetAccessRule($fileSystemAccessRuleR) $FolderACL.SetAccessRule($fileSystemAccessRuleR)
$FolderACL.SetAccessRule($fileSystemAccessRuleW) $FolderACL.SetAccessRule($fileSystemAccessRuleW)
$FolderACL.SetAccessRule($fileSystemAccessRuleWR)
Set-Acl -Path $folder.FullName -AclObject $FolderACL
return $ret return $ret
} }