【发布时间】:2016-05-26 15:24:41
【问题描述】:
我目前有一个脚本可以获取文件夹和该文件夹中所有文件夹的权限(递归),脚本如下。
$OutFile = "C:\temp\Permissions.csv"
$Header = "Folder Path,IdentityReference,AccessControlType,IsInherited,InheritanceFlags,PropagationFlags"
Del $OutFile
Add-Content -Value $Header -Path $OutFile
$RootPath = "\\Fileshare\Folder"
$Folders = dir $RootPath -recurse | where {$_.psiscontainer -eq $true}
foreach ($Folder in $Folders){
$ACLs = get-acl $Folder.fullname | ForEach-Object { $_.Access }
Foreach ($ACL in $ACLs){
$OutInfo = $Folder.Fullname + "," + $ACL.IdentityReference + "," + $ACL.AccessControlType + "," + $ACL.IsInherited + "," + $ACL.InheritanceFlags + "," + $ACL.PropagationFlags
Add-Content -Value $OutInfo -Path $OutFile
}}
这部分脚本很好。我想继续获取脚本以获取文件夹权限中列出的任何组的成员,然后获取组中的成员,在 Excel 中为每个列出的组创建另一个工作表。该工作表将是组的名称,而该工作表内将是该组内的成员。
有没有人能指点一下如何去做这件事?
提前致谢。
SG
【问题讨论】:
标签: excel powershell permissions ntfs