我正在编写一个脚本,我被困在尝试将AD组修改权限授予共享路径。目前,当运行时,它确实会将组添加到文件夹中,但只具有“列表”权限。有什么想法吗?
$groupname = "group_users"
$fullsharepath = "\\severname\servervol\share"
$acl = Get-Acl $fullsharepath
$permission = "domain\$groupname","Modify", [System.Security.AccessControl.InheritanceFlags]"ContainerInherit", [system.security.accesscontrol.PropagationFlags]"None","Allow"
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $permission
$acl.SetAccessRule($accessRule)
$acl | Set-Acl $fullsharepath -Verbose发布于 2022-07-08 14:01:11
您的代码正在为我工作,知道您的域名是domain。
否则,如果您与组所在的域相同,只需从"domain\$groupname"中删除"domain\$groupname"。
下面是另一个更简单的例子:
$ACL = Get-Acl -Path "\\severname\servervol\share"
$groupname = "group_users" #or "yourDomain\group_users"
$Ace = New-Object System.Security.AccessControl.FileSystemAccessRule("$groupname","Modify", "ContainerInherit", "None", "Allow")
#Append the ACE to the ACL
$ACL.AddAccessRule( $Ace )
#Push settings
Set-Acl -AclObject $ACL $fullsharepathhttps://stackoverflow.com/questions/72911457
复制相似问题