From 85eeec864cef12c6136ace0edd50cc8d3c204d74 Mon Sep 17 00:00:00 2001 From: Karl-Wilfried Zimmer Date: Sun, 14 Jul 2024 23:50:35 +0200 Subject: [PATCH] fixed acl issue --- NewProject2.ps1 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/NewProject2.ps1 b/NewProject2.ps1 index 8cdbcf4..45432b3 100644 --- a/NewProject2.ps1 +++ b/NewProject2.ps1 @@ -65,15 +65,16 @@ if($PSBoundParameters.ContainsKey("ProjectName")){ $FolderACL= Get-Acl -Path $folder - $rid = $ReadTarget.Name - $wid = $WriteTarget.Name + $rid = $ReadTarget.SID + $wid = $WriteTarget.SID $fsrr = "ReadAndExecute" $fsrw = "Write" $type = "Allow" - $fileSystemAccessRuleR = New-Object System.Security.AccessControl.FileSystemAccessRule($rid,$fsrr,"ContainerInherit, ObjectInherit",,$type) - $fileSystemAccessRuleW = New-Object System.Security.AccessControl.FileSystemAccessRule($Wid,$fsrw,"ContainerInherit, ObjectInherit",,$type) - $fileSystemAccessRuleWR = New-Object System.Security.AccessControl.FileSystemAccessRule($rid,$fsrr,"ContainerInherit, ObjectInherit",,$type) + + $fileSystemAccessRuleR = New-Object System.Security.AccessControl.FileSystemAccessRule($rid.Name,$fsrr,"ContainerInherit, ObjectInherit","None",$type) + $fileSystemAccessRuleW = New-Object System.Security.AccessControl.FileSystemAccessRule($wid.Name,$fsrw,"ContainerInherit, ObjectInherit","None",$type) + $fileSystemAccessRuleWR = New-Object System.Security.AccessControl.FileSystemAccessRule($wid.Name,$fsrr,"ContainerInherit, ObjectInherit","None",$type) $FolderACL.SetAccessRule($fileSystemAccessRuleR) $FolderACL.SetAccessRule($fileSystemAccessRuleW)