点击查看代码
$file_path= "E:\"
$files = Get-Childitem -Path $file_path -Recurse -ErrorAction SilentlyContinue
$result = foreach($file in $files)
{
#Write-Host $file.FullName
$file_Info=Get-Acl $file.FullName
for ($i=0; $i -lt $file_Info.Access.Count; $i=$i+1)
{
if( $file_Info.Access[$i].IsInherited -ne "True")
{
$res= $file.FullName+'|'+$file_Info.Access[$i].IdentityReference.Value+'|'+ $file_Info.Access[$i].FileSystemRights.ToString()+'|'+$file_Info.Access[$i].AccessControlType.ToString() +'|'+ $file_Info.Access[$i].IsInherited
$res |Out-File -FilePath D:\text2.csv -Append -Encoding utf8
}
}
}