This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Retrieves the date when a file was taken or created. | |
.DESCRIPTION | |
The Get-DateTaken function uses the Windows Shell COM object to access file properties that aren't directly accessible through .NET's System.IO classes. It attempts to retrieve the "Date taken" property of the file. If this property is not available, it retrieves the "Date created" property instead. The retrieved date string is sanitized and parsed into a DateTime object. | |
.PARAMETER file | |
The file for which the date taken or created is to be retrieved. This parameter is mandatory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Param( | |
[Parameter(Mandatory=$True)] | |
[string]$FilePath | |
) | |
$Files = Get-ChildItem "$FilePath\*.docx" | |
$Word = New-Object -ComObject Word.Application | |
Foreach ($File in $Files) { |