Jump to content
Microsoft Windows Bulletin Board

Powershell files and folders, and modified date


Recommended Posts

Guest Keith_7
Posted

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...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...