#Set the directory path and new date and time where the photo is located
$path = "X:\Family selected photos\Grandpa celebrates his 90th birthday"
$newDate = [datetime]"2010-11-01 12:00:00"
#Define the image extension to be processed
$imageExtensions = @(".jpg", ".jpeg", ".png", ".gif", ".bmp", ".tiff") #Add or delete as needed
#Get all image files in the directory, including subdirectories
Get-ChildItem -Path $path -Recurse | Where-Object { $imageExtensions -contains $_.() } | ForEach-Object {
#Modify creation time
$_.CreationTime = $newDate
#Modify the last modification time
$_.LastWriteTime = $newDate
#If you also need to modify the access time, you can cancel the comment on the following line
# $_.LastAccessTime = $newDate
}
Write-Output "The timestamp update is complete."