Powershell Script to Find certain file extension, path size - need help adding last modified date

Hi All,

I found the folowing PS Script on the web but cant figure out how to add the last modified date to it

could someone help?

$Search = "\\cifs\v7000-cifs\USERVOLUME\"
$Outfile = "C:\SCRIPT\report.csv"
$Files = Dir $Search -recurse  -include  *.pst,*.ost -EA SilentlyContinue | 
	select-object Length,name,Fullname,extension | sort-Object extension

$Files | Export-Csv $Outfile -NoTypeInformation

$Files | Group extension -NoElement | % {$Ext = $_.Name;$_ | Select @{N="Extension";E={$_.Name}},Count,`
		@{N="SizeMB";E={"{0:N2}" -f (($Files | ?{$_.extension -eq $Ext} | Measure Length -Sum).Sum /1MB)}}} | 
		ConvertTo-Csv -NoTypeInformation | Out-File $Outfile -Append -Encoding ASCII

Open in new window

LVL 1
WeanAsked:
Who is Participating?
 
SubsunCommented:
Just select the property LastWriteTime..
$Search = "\\cifs\v7000-cifs\USERVOLUME\"
$Outfile = "C:\SCRIPT\report.csv"
$Files = Dir $Search -recurse  -include  *.pst,*.ost -EA SilentlyContinue | 
	select-object Length,name,Fullname,extension,LastWriteTime | sort-Object extension

$Files | Export-Csv $Outfile -NoTypeInformation

$Files | Group extension -NoElement | % {$Ext = $_.Name;$_ | Select @{N="Extension";E={$_.Name}},Count,`
		@{N="SizeMB";E={"{0:N2}" -f (($Files | ?{$_.extension -eq $Ext} | Measure Length -Sum).Sum /1MB)}}} | 
		ConvertTo-Csv -NoTypeInformation | Out-File $Outfile -Append -Encoding ASCII

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.