Hi all,
I am trying to put together a little script to check the last modified time of a user share and i keep running into brick walls
essentially i have a share on a server with individual user shares, IE:
H:/Users/User1H:/Users/User2H:/Users/User3...i am trying to get a report that will search each folder individually and report according to the example belowUsername LastWriteTime ItemSizeUser 1 3/21/2012 6:05:33 PM 5.7 GBUser 2 3/18/2012 3:57:28 PM 1.3 GB
i have experimented with:
Get-ChildItem -Recurse | Where-Object { $_.PSIsContainer } | Sort-Object LastWriteTime -Descending | Select-Object Name,LastWriteTime -First 1
but this returns the subfolder name's information and recurse into all user shares so i will get an output such asName LastWriteTime Contacts 3/21/2012 6:05:33 PM
not sure what process i should take to get the desired output, any help or finger in the correct direction would be greatly appreciatedThanks in advance -Kevin
Try something like this
Get-ChildItem -Path "C:\PersonalData\MyBooks\PowerShell and WMI" -Recurse | where { $_.PSIsContainer} |foreach { $size = Get-ChildItem -Path $_.FullName -Recurse | measure -Sum Length | select -ExpandProperty Sum Add-Member -InputObject $($_) -MemberType NoteProperty -Name Size -Value $size
$_ | select Fullname, LastWriteTime, @{N="Size(MB)"; E={[math]::Round(($_.Size/1mb), 2)}}} | Format-Table -AutoSize -Wrap
You will need to change MB to GB in the select statement