PowerShell: Changing Files and Folders Creation Time

Working with PowerShell is usually a serious and demanding job. PowerShell is powerful, you can destroy your system by running the wrong commands. However, in this blog post we take a look at something funny. But it’s possible that what we’re about to do you might need for something serious. Now let’s start. We are going to change the creation time of a file or folder. With PowerShell, what else?

PowerShell Attributes and Methods

As already mentioned in my series PowerShell for Beginners, Attributes show what an object is and methods let us do something with objects.

The Power of PowerShell is object-orientation. This is what distinguishes PowerShell from many other tools. You have to deal with Objects. Otherwise you will never realize the power of PowerShell.

And further …

Attributes show you what an Object is. Methods can change or do something.

More about Attributes and Methods here:

PowerShell for Beginners (Part 8): The Power of PowerShell – Getting in Touch with Objects (Get-Member, Select-Object)

Ok, let’s start. We are going to try changing the creation time of a file.

Changing the Creation Time of a File with the .NET Method

C:\Temp\Test.txt ist a simple text file. It was created on July 13th 2019. This is our starting point.


Changing the creation time means working with PowerShell methods. While running Get-ChildItem along with Get-Member we discover that there is an attribut called CreationTime.

Get-ChildItem -Path C:\Temp\Test.txt | Get-Member -MemberType Properties


Finally, we call a .NET method to change the creation time to July 7th, 1643.

(Get-ChildItem -Path C:\Temp\Test.txt).CreationTime='07.07.1643'


Nice one! We’re done. Check out your changes in Windows Explorer and/or PowerShell.


Get-ChildItem -Path C:\Temp\Test.txt | Select-Object -Property CreationTime


See you next time with Powershell and doing more serious stuff!

Categories: PowerShell

Tagged as: ,

3 replies »

  1. Here’s an example: I’ve a drone with no GPS-Tracks and every time it captured pictures or videos, the date and time stamps is set to something like 1901-01-01… not really useful after you import them into your computer.

    Liked by 1 person

  2. While I find it cool that we can change the creation date and time, when would this come in handy? I cannot think of a time in the last 25 years I needed to change this.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.