PS U:\> PS U:\> $OutFile = "C:\temp\Documents\Permissions1.csv" # Insert folder path where you want to save your file and its name
$Header = "Folder Path,IdentityReference,AccessControlType,IsInherited,InheritanceFlags,PropagationFlags"
$FileExist = Test-Path $OutFile
If ($FileExist -eq $True) {Del $OutFile}
Add-Content -Value $Header -Path $OutFile
$RootPath = "\\server\sharename" # Insert your share path
Get-ChildItem $RootPath | where {$_.psiscontainer} | where { $_ | Get-Acl | select -ExpandProperty Access | where {$_.IdentityReference -contains $aclfullname}}
$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
}}
Thanks in advance.