私は特定のパスとそのすべてのサブディレクトリのアクセスACLを与えて.txtに入れておくスクリプトを書いていましたが、可視性とアクセスが容易なデータベースを作成するには、別の形式でそれを必要とします。出力のFileSystemRightsを特定の形式で入手するにはどうすればよいですか?
一部は次のようになります。
Fullname S FileSystemRights S AccessControlType ---------- ------------------ ------------------ C:\temp ; ReadAndExecute, Synchronize ; Allow;
だから私は、出力がどのように見えるために必要なものを、このようなものです:あなたは私は個人の権利を必要と見ることができるように
Fullname S FileSystemRights S AccessControlType ---------- ------------------ ------------------ C:\temp ; ReadAndExecute ; Allow; C:\temp ; Synchronize ; Allow;
個々の線と一緒に積み重ねられません。
次のことをされて見えます私は、これまで行ってきた、多分それは(私は重要でないものを除外)に役立ちます:
(Get-Acl $TestPath).Access |
Format-Table -AutoSize -HideTableHeaders @{L="Fullname";E={$TestPath}},
@{L="S";E={";"}}, FileSystemRights,
@{L="S";E={";"}}, AccessControlType,
@{L="S";E={";"}}, IdentityReference,
@{L="S";E={";"}}, IsInherited,
@{L="S";E={";"}}, InheritanceFlags,
@{L="S";E={";"}}, PropagationFlags |
Out-File $Out -Append -Width 500
function RecDirs {
$d = $Args[0]
$AktRec++
$dirs = dir $d | where {$_.PsIsContainer}
if ($AktRec -lt 3) {
foreach($di in $dirs) {
if ($di.FullName -ne $null) {
(Get-Acl $di.Fullname).Access |
Format-Table -AutoSize -HideTableHeaders @{L="Fullname";E={$di.FullName}},
@{L="S";E={";"}}, FileSystemRights,
@{L="S";E={";"}}, AccessControlType,
@{L="S";E={";"}}, IdentityReference,
@{L="S";E={";"}}, IsInherited,
@{L="S";E={";"}}, InheritanceFlags,
@{L="S";E={";"}}, PropagationFlags |
Out-File $Out -Append -Width 500
}
RecDirs($di.Fullname)
}
}
}
RecDirs($TestPath)
export-csv – guiwhatsthat