我必须根据地址列表创建一组文件夹,然后在活动目录中配置权限。创建文件夹和子文件夹对我来说很有效,我改编了在线找到的几行:
这将根据地址列表创建文件夹。
$FolderNames = Get-Content -Path "E:\Data\addresses.txt"
$DirectoryPath = "E:\Data\buildings"
ForEach ($FolderName in $FolderNames)
{
New-Item -ItemType Directory -Path (Join-Path -Path $DirectoryPath -ChildPath $FolderName)
}
这将创建子文件夹
$FolderNames = "E:\Data\addresses.txt"
New-item "E:\Data\buildings\$env:foldernames\*" -Name "Patrimonium" -ItemType Directory
New-item "E:\Data\buildings\$env:foldernames\*" -Name "Social Services" -ItemType Directory
New-item "E:\Data\buildings\$env:foldernames\*" -Name "Administration" -ItemType Directory
New-item "E:\Data\buildings\$env:foldernames\*" -Name "Patrimonium\subfolder1" -ItemType Directory
New-item "E:\Data\buildings\$env:foldernames\*" -Name "Patrimonium\subfolder2" -ItemType Directory
New-item "E:\Data\buildings\$env:foldernames\*" -Name "Social Services\subfolder1" -ItemType Directory
New-item "E:\Data\buildings\$env:foldernames\*" -Name "Social Services\subfolder2" -ItemType Directory
New-item "E:\Data\buildings\$env:foldernames\*" -Name "Administration\subfolder" -ItemType Directory
New-item "E:\Data\buildings\$env:foldernames\*" -Name "Administration\subfolder2" -ItemType Directory
所以现在我想禁用继承并为每个名为“Patrimonium”、“Social Services”、“Administration”的子文件夹设置 ACL。每个文件夹都有自己的安全组。下面的子文件夹需要继承权限。老实说,我不知道从哪里开始。这可能吗?