1
我有一個腳本,用於檢查文件夾中的ACL權限並將它們寫入CSV文件。我想繼承當輸出出來是這樣的:使用數組獲取ACL子文件夾
Allow Full Control, this folder, subfolders and files (Inherited)
目前其唯一的輸出是:
Allow FullControl, (Inherited)
有人可以告訴我,請我只是想失蹤文字顯示:
$RootPath = "C:\"
$Folders = dir $RootPath -recurse | where {$_.psiscontainer -eq $true}
$isInherited = @{
$true = 'Inherited'
$false = 'Not Inherited'
}
$inheritance = @{
0 = 'files only'
1 = 'this folder and subfolders'
2 = 'this folder and files'
3 = 'subfolders and files'
}
$fldr = $Folder.FullName
$Folders | % {
$fldr = $_.FullName
Get-Acl $fldr | select -Expand Access |
select @{n='Account';e={$_.IdentityReference}},
@{n='Ace String';e={"{0} {1}, {2} ({3})" -f $_.AccessControlType,
$_.FileSystemRights, $inheritance[$_.InheritanceFlags],
$isInherited[$_.IsInherited]}},
@{n='Object Path';e={$fldr}} |
ConvertTo-Csv -NoTypeInformation |
Select -Skip 1 | % {$_ -replace '"', ""} |
Out-File $OutFile -Force -Encoding ascii -Append
}
謝謝,自從昨天以來,這一直使我頭痛。 – user3772927