我必须删除一个目录(及其子目录和文件)的所有普通用户(即非管理员)的所有权限。的PowerShell:删除一个目录下的所有权限的所有用户
我试图在PowerShell中以下,但什么都没有发生:
New-Item "C:\Test" -type Directory
$acl=get-acl "C:\Test"
$inherit=[system.security.accesscontrol.InheritanceFlags]"ContainerInherit,ObjectInherit"
$propagation=[system.security.accesscontrol.Propagation]"None"
$ar=New-Object system.security.accesscontrol.FileSystemAccessRule("Users","FullControl",$inherit,$propagation,"Allow")
$acl.RemoveAccessRuleAll($ar)
Set-Acl "C:\Test" $acl
如果我尝试用$env:computername\Users
(而不是仅仅Users
)我得到以下错误: Exception calling "RemoveAccessRuleAll" with "1" argument(s): "Some or all identity references could not be translated.
“
什么身份是否必须通过才能识别所有用户?