Converting the FileSystemObject's DateLastModified Property

Definition: Returns the date and time the file was last modified.

DateLastModified

To retrieve the last-modified date and time in PowerShell, you first need to retrieve a reference to the file by passing the name of the file to the Get-Item cmdlet. Then you can retrieve the last-modified date and time from the LastWriteTime property:

(Get-Item c:\scripts\test.txt).LastWriteTime

See conversions of other FileSystemObject methods and properties.
Return to the VBScript to Windows PowerShell home page