Powershell – 查找文件夹权限并扩展组成员

我目前有一个脚本抓取文件夹和所有文件夹等(recursion)的权限,脚本如下。

$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 }} 

这部分脚本是好的。 我想继续获取脚本以获取文件夹权限中列出的任何组的成员,然后获取组中的成员,然后在列出的每个组中创build另一个工作表。 该表将是该组的名称,该表内将是该组内的成员。

有没有人有任何指导如何去做这件事?

提前致谢。

SG

作为一般指针:

  1. 要获取域的组成员信息,您需要使用Active Directory模块,或使用ADSI adpater进行查询。
  2. 那么也考虑你可以打一个本地的操作系统组,可以使用像`net localgroup'这样的东西。 PowerShell的例子