Author Posts

October 28, 2016 at 9:51 am

Hey all,

I need to get a number for files modified within a 7day and 30 day period. I'm not bothered about what the file name is or date it was modified just the count.

Anybody help out?

October 28, 2016 at 11:07 am

you could use Get-ChildItem and Where-Object to look for the property 'LastWriteTime'

Or you could search for prewritten scripts in Microsoft Technet Script Gallary

October 29, 2016 at 10:34 am

I was playing around a bit, but I believe this should do the trick:

(Get-ChildItem | where { $_.LastWriteTime -lt (Get-Date).AddDays(-7) -and $_.LastWriteTime -gt (Get-Date).AddDays(-30)} | measure).Count