1
我想這個PowerShell腳本創建一個新的目錄,並添加/分配組的權限。與powershell分配文件夾權限的問題
該組正在添加,但權限未顯示在「安全」選項卡上的「屬性」下。如果要升級安全性,則權限確實顯示在那裏。
另外,父文件夾權限不會根據需要從新子文件夾中刪除。
$groups = "DOMAIN\GROUP"
$Perm = "MODIFY"
$Permission = [System.Security.AccessControl.FileSystemRights] $Perm
$AllInherit = [System.Security.AccessControl.InheritanceFlags] "None"
$AllPropagation = [System.Security.AccessControl.PropagationFlags] "InheritOnly"
$path = "c:\temp\test"
new-item -path $path -itemtype directory -force
$group = $groups
$GetACL = Get-Acl $Path
$Access = New-Object System.Security.Principal.NTAccount ($group)
$AccessRule = New-Object system.security.AccessControl.FileSystemAccessRule($Access, $perm, $AllInherit, $Allpropagation, "Allow")
$GetACL.SetAccessRule($AccessRule)
SET-ACL -PATH $path $getacl
此外,InheritOnly傳播沒有正確設置。 –