Find all files modified after specified date

PowerShell is a powerful scripting tool included in Windows 7 / Windows Server 2008 R2 and all other subsequent Windows operating systems.

Why? You can’t do everything from the GUI. For example, the Exchange GUI is designed to be used for only the most common admin tasks.

Microsoft says, “It’s safe to say that the single most important skill a Windows administrator will need in the coming years is proficiency with Windows PowerShell.”

Back to the problem, how do I find all files modified after a certain date using PowerShell?

1) Start by opening a PowerShell window. If you need to scan files in system folders, right click, and select “run as administrator”.

2) Type the command Get-ChildItem . This gets the items and child items in one or more specified locations. It has aliases ls  and dir . In its basic form the Get-ChildItem  cmdlet provides functionality similar to the dir  command.

3) Specify the path. The default location is the current directory. Get-ChildItem “C:\Windows”

4) The parameter -recurse gets the items in the specified locations and in all child items of the locations. In this example, it will get the names of the subfolders and the contents of those subfolders. Get-ChildItem “C:\Windows\Temp” -recurse

5) The information returned by Get-ChildItem  can be piped into the Where-Object  cmdlet, used to filter data returned by other cmdlets. $_.lastwritetime  is the NTFS last modified date (UTC style yyyy/mm/dd). Get-ChildItem “C:\Windows\Temp” -recurse | Where-Object {$_.lastwritetime -gt “2016/09/29”}

6) Write the results to file using the Out-File  cmdlet. The -append  option adds new results to the existing file. Get-ChildItem “C:\Windows\Temp” -recurse | Where-Object {$_.lastwritetime -gt “2016/09/29”} | Out-File PowerShell_Output.txt -append

7) Optional. Use the Format-Table cmdlet to write the results in a table, specifying which columns are required. The -autosize  option indicates that the cmdlet adjusts the column size and number based on the width of data. Get-ChildItem “C:\Windows\Temp” -recurse | Where-Object {$_.lastwritetime -gt “2016/09/29”} | Format-Table fullname, lastwritetime -autosize | Out-File PowerShell_Output.txt -append

You May Also Like