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)