PowerShell script to list files modified after a certain date
Let’s say you manage a web farm and there are a lot of front end web servers and they are basiclly the same. But as there are so many “cooks in the kitchen”, sometimes the files (for example, the hosts file)are modified unexpectely. You want to identify if the files are modified after certain date (like the release date). You can run the below script against target folder
get-childitem –recurse | where-object {$_.lastwritetime -gt “1/13/2008”}
To find our all the files in the target directory modified in the last 15 days:
$DateToCompare = (Get-date).AddDays(-15)
Get-Childitem –recurse | where-object {$_.lastwritetime –gt $DateToCompare}
Now you can easily modify the above script for multiple remote machines.