PowerShell Script needing to pull "Date Modified" on folder properties

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”

Martin,
Welcome to the forum. :wave:t4:

Your code is broken or incomplete. That might be because you did not format it as code. Please fix that.

When you post code, sample data, console output or error messages please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.

Thanks in advance

How to format code in PowerShell.org <---- Click :point_up_2:t4: :wink:

Regardless of that - you should not use aliasses in scripts and in forums as it makes the code harder to read.

You can read more about good style and best practices here:

And BTW: the property LastWriteTime of a folder is determined by the LastWriteTime of the last modified file inside the folder. :point_up_2:t4: