1

(Get-Item $SymLink).LastWriteTime return's the SymLink's last modified time and not the target's modified time.

How do I get the target's last modified time?

Ujjwal Singh
  • 4,908
  • 4
  • 37
  • 54

1 Answers1

1

There appears to be no direct way, thus for now this will have to be done in two steps-

  1. Get the path of the SymLink's target
  2. Get the LastWriteTime from the target's path

To determine if its a symlink: Check if SymLink - PowerShell
To get the path:

  1. use the Dir command's summary output - from which the target information can be snipped out - using RegEx.
  2. or using Native API Call: GetFinalPathNameByHandle; see: Calling Unmanaged Code from PS
Community
  • 1
  • 1
Ujjwal Singh
  • 4,908
  • 4
  • 37
  • 54