我必須刪除一個目錄(及其子目錄和文件)的所有普通用戶(即非管理員)的所有權限。的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.
「
什麼身份是否必須通過才能識別所有用戶?