不幸的是,我不太熟悉PowerShell,而我的Google技巧尚未解決我的問題。遞歸列出來自網絡共享和列表組成員的文件夾和子文件夾
到目前爲止,我有以下腳本:
Get-childitem \\network\share\ -recurse | where{$_.psiscontainer} |
Get-Acl | % {
$path = $_.Path
$_.Access | % {
New-Object PSObject -Property @{
Folder = $path.Replace("Microsoft.PowerShell.Core\FileSystem::","")
Access = $_.FileSystemRights
Control = $_.AccessControlType
User = $_.IdentityReference
Inheritance = $_.IsInherited
}
}
} | ? {-not $_.Inheritance} | export-csv output.csv -force
哪些(部分)給了我下面的輸出:
User Folder
$DOMAIN\network_share_sub1_write \\network\share\sub1
$DOMAIN\network_share_sub1_read \\network\share\sub1
$DOMAIN\network_share_sub1_subsub1_write \\network\share\sub1\subsub1
$DOMAIN\network_share_sub2_write \\network\share\sub2
這裏的問題是,我要回去看看各組看各個用戶。我想要的是這樣的:
User Permission Folder
$User1 write \\network\share\sub1
$User2 read \\network\share\sub1
$User3 write \\network\share\sub1\subsub1
$User1 write \\network\share\sub2
是這樣的可能嗎? 在此先感謝。
我不打算提出一個明確的答案,但我會用$ _。的IdentityReference在ACL和檢查AD一些AD命令行開關,看看他們是羣體,如果是的話,得到小組的成員。希望能讓你開始。 –