[英]Inheritance of Permissions Powershell Script
I am trying to create a script that will pass down inheritance of the subfolder. 我正在尝试创建一个脚本,该脚本将传递子文件夹的继承。
For example: 例如:
C:/template has x y z permissions
C:/template/test only has x permissions
I want all sub folders and files from C:/template to get the xyz permissions. 我希望C:/ template中的所有子文件夹和文件都获得xyz权限。
Something similar to the script here that Robert Prust made (it does not execute): 与Robert Prust在此处执行的脚本类似(它不执行):
$ACL = Get-Acl -Path C:\Template
$Folders = Get-ChildItem -Recurse -Path "C:\new_perm" -Filter 'Subfolder*' | Select-Object -ExpandProperty FullName
foreach ($Folder in $Folders) {
# write the variables found - check if the folder path is correct
# Write-Output "This foldername is $Folder"
# convert foldername to a icacls approved path
$icacls = "$Folder\*"
# check if the icacls path is correct
# Write-Output "icacls path is $icacls"
#set the ACL required on the folder
Set-ACL -Path $Folder -AclObject $ACL
# replace all child permissions for the folder
icacls $icacls /q /c /t /reset
}
Thanks, 谢谢,
Jonathan 乔纳森
Just run icacls "C:\\template\\*" /q /c /t /reset
. 只需运行
icacls "C:\\template\\*" /q /c /t /reset
。 It doesn't get simpler than that. 没有比这更简单的了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.