PowerShell for Windows Admins

Apr 18 2019   1:07PM GMT

File times

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Tags:
Powershell

There are three pairs of file times that are available on files on Windows

PS> Get-ChildItem -Path C:\test\Newoutdata01.txt | select *time*

CreationTime      : 14/04/2019 17:28:41
CreationTimeUtc   : 14/04/2019 16:28:41
LastAccessTime    : 14/04/2019 17:28:41
LastAccessTimeUtc : 14/04/2019 16:28:41
LastWriteTime     : 25/02/2019 17:42:49
LastWriteTimeUtc  : 25/02/2019 17:42:49

This is how to modify those times

Use Get-ChildItem to iterate through the files. For each file use Set-Property to set the value on the appropriate property. The values I’m using are purely random – you’d normally use a known value.

The *Utc version of the properties will be automatically set based on its corresponding property

 

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: