Hi All,
I am working on a PowerShell script that needs to export to CSV file all folders that are up to 3 levels deep
The script needs to pull the permissions from the folder as well as the Last date modified of the folder.
I have the permissions and depth sorted but need to get the last date modified working and showing on the csv file.
Any help would be appreciated
Here is the script I’m using
$FolderPath = dir -Directory -Path “\fs1\Shared” -Recurse -Depth 3
$Report = @()
Foreach ($Folder in $FolderPath) {
$Acl = Get-Acl -Path $Folder.FullName
foreach ($Access in $acl.Access)
{
$Properties = [ordered]@{‘FolderName’=$Folder.FullName;‘AD
Group or
User’=$Access.IdentityReference;‘Permissions’=$Access.FileSystemRights;‘Inherited’=$Access.IsInherited}
$Report += New-Object -TypeName PSObject -Property $Properties
}
}
$Report | Export-Csv -path “C:\data\FolderPermissions.csv”