This PowerShell function lets you easily access Microsoft Office File Properties like DateLastSaved or Author or Rivision count!
- Load the function
- Call the function
- Love the function
C:\temp\Preferences> Get-OfficeFileInfo C:\temp\UsersOfabc.comDomain.xlsx
Name Exp
---- ---
Title
Subject
Author
Keywords
Comments
Template
Last author Stephen Owen
Revision number
Application name Microsoft Excel
Creation date 7/21/2021 11:30:51 AM
Last save time 7/21/2021 11:30:51 AM
Security 0
Category
Format
Manager
Company
Hyperlink base
Content type
Content status
Language
Document version
Get-OfficeFileInfo C:\temp\SomeDoct.docx
#Also works!
This was implemented as a powershell module but you can just use the source without the last line.
If you'd like to keep it as a module, just store the source in a *.psm1 file and import it into your workspace or call it as necessary:
Import-Module "\path\to\file.psm1" -Verbose]---> Verbose flag confirms the Get-OfficeFileInfo function was successfully pulledUsage:
To get all properties of a file use:
To get a specific property:
call the function, pipe the properties, and get the value of said desired property like so:
TODO/Improvement:
$OfficeAppvariable and implement a way to attempt to open any applicable file via brute force that way you don't need to define filetypes manually