I've written a small and rather simple powershell cmdlet which allows you to list the core and application properties of office documents, so that you can do something like this:
Samples:
Get-DocProps –path "*.docx" | where { $_.Creator –eq "John Doe" }
Get-ChildItem "*.docx" | get-docprops | where { $_.Lines –gt 100 } | select Path,Lines
Get-ChildItem * -include "*.docx","*.xlsx" –recurse | get-docprops | select Path, Creator, Lines, Paragraphs
Get-ChildItem * -include "*.docx" –recurse | get-docprops | measure-object Words,Lines,Paragraphs –sum –min –max -ave
The Cmdlet itself reads the docProps/app.xml and docProps/core.xml files inside Office 2007 documents using the System.IO.Packaging namespace, so therefore install .NET Framework 3.0 to use this cmdlet.
You can download the DocProps Cmdlet here. (No warranty, provided "AS IS", use at your own risk ;-)) If you are interested in the source code just drop me a mail.
After installation just run
add-pssnapin DocProps.Snapin
at your powershell command prompt and enjoy.
Here is a list of the core properties:
Property Name | Type |
Category | String |
Created | DateTime |
Creator | String |
Description | String |
Keywords | String |
Language | String |
LastModifiedBy | String |
LastPrinted | DateTime |
Modified | DateTime |
Revision | String |
Subject | String |
Title | String |
Version | String |
Word Documents additionally have following properties:
Property Name | Type |
Template | String |
TotalTime | String |
Pages | Int32 |
Words | Int32 |
Characters | Int32 |
Application | String |
DocSecurity | String |
Lines | Int32 |
Paragraphs | Int32 |
ScaleCrop | String |
Company | String |
LinksUpToDate | Boolean |
CharactersWithSpaces | Int32 |
SharedDoc | Boolean |
HyperlinksChanged | Boolean |
AppVersion | String |
I also run into some implementation, which uses Windows Search to filter for properties.
For several more cmdlets visit the Powershell Community Extensions Project at Codeplex.
Right at the moment there's just a get-docprop cmdlet included in the setup, the set-docprop will follow in a few days, so come back again ;-)
Next week I'm going to have a talk for the Sql Server Usergroup located in Vienna, Austria.
Following topics will be covered:
- Overview of Powershell
- Powershell & .NET Integration
- Usage of Sql Management Objects with Powershell
- Data Visualization and Graphical Monitoring
If you are interested in this talk for your Usergroup feel free to contact me.
Registration for the upcoming event is open here.