【问题标题】:Powershell - Find Folder Permissions and Expand Groups MembersPowershell - 查找文件夹权限并展开组成员
【发布时间】: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


    【解决方案1】:

    作为一般指针:

    1. 要获取域组的成员信息,您需要使用 Active Directory 模块,或使用 ADSI adpater 进行查询。
    2. 然后考虑您可以访问本地操作系统组,可以使用类似“net localgroup”的内容。 Examples here for PowerShell.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-28
      • 1970-01-01
      • 2013-02-07
      • 1970-01-01
      • 2013-07-08
      • 1970-01-01
      • 1970-01-01
      • 2019-03-09
      相关资源
      最近更新 更多