Use Powershell to change file date/time stamps

Ever wanted to change the creation date/time on a file on Windows – Powershell offers the following (change Filename.ext to your filename)

$(Get-Item Filename.ext).creationtime
$(Get-Item Filename.ext).lastwritetime
$(Get-Item Filename.ext).lastaccesstime

Want to change these? You can supply the date in a string like this

$(Get-Item Filename.ext).creationtime = "15 March 2022 19:00:00"
$(Get-Item Filename.ext).lastwritetime = "15 March 2022 19:00:00"
$(Get-Item Filename.ext).lastaccesstime = "15 March 2022 19:00:00"

or if you like you’ve got

$(Get-Item Filename.ext).creationtime = $(Get-Date)
$(Get-Item Filename.ext).creationtime = $(Get-Date "15/03/2022 19:00:00")

Note: I’m on a en-GB machine hence using dd/MM/yyyy format – ofcourse changes this to your culture format.