Powershell files and folders, and modified date

K

Keith_7

I am still a newbie at PowerShell. My end result at this time is to find permissions on files and folders, and modified date into a csv file for all of them on a windows 2016 server. I found the PowerShell below that gives me the permissions but no modified date. Is there a way to insert a added command to do that?


$FolderPath = dir -Directory -Path "C:\data" -Recurse -Force
$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:\Temp\FolderPermissions.csv"

Continue reading...
 
Back
Top Bottom