I have created the below script, which has been tested and working successfully, to amend the 'Last Modified Date' of all files contained in the selected folder.
$a = Get-Date "22/11/2012 10:00 AM"
$b = Get-ChildItem "C:\MyFiles"
foreach ($i in $b)
{
$i.LastWriteTime = $a
$a = $a.AddMinutes(1)
}
$b
I am just looking for some help amending this script to include all subfolders/file within the selected folder, as I am currently having to amend this manually to change the date within the sub-folders of "C:\MyFiles".. for e.g. "C:\MyFiles\A", "C:\MyFiles\B".. etc.
In addition.. I was also wondering how I can remove the line "$a = Get-Date "22/11/2012 10:00 AM" so that it automatically sets the date to todays, and I do not have to enter a date manually.