我发现以下内容似乎适用于它,但我需要更改两件事,并且无法弄清楚。
$acl = Get-Acl D:\New
$permission = "Everyone","Read","Allow"
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $permission
$acl.SetAccessRule($accessRule)
$acl | Set-Acl D:\New
答案 0 :(得分:0)
如有疑问,请阅读documentation。您需要将标识从"Everyone"
更改为"$env:COMPUTERNAME\HomeGroup"
并设置相应的inheritance和propagation标记。
$identity = "$env:COMPUTERNAME\HomeGroup"
$accessRight = 'Read'
$inheritance = 'ContainerInherit, ObjectInherit'
$propagation = 'None'
$type = 'Allow'
$accessRule = New-Object Security.AccessControl.FileSystemAccessRule (
$identity, $accessRight, $inheritance, $propagation, $type
)