Ying Li at myITforum.com

PowerShell & System Center

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.

Posted: Jan 28 2008, 09:42 PM by yli628 | with 1 comment(s)
Filed under:

Comments

Pages tagged "certain" said:

Pingback from  Pages tagged "certain"

# January 29, 2008 5:02 AM