

HSG-7-24-12.docx 1035 edwils guest blogger, powershell , “number of words”, author, keywords | ft -AutoSize invokemember(“value”,$binding::GetProperty,$null,$pn,$null) invokemember(“item”,$binding::GetProperty,$null,$BuiltinProperties,$p) I use Write-Host for this so I can specify the color (blue). If an error occurs, I print a message via Write-Host that the value was not found. Both the name and the value of the built-in document properties are assigned to the hash table as a keyvalue pair. I already know the name of the property that I desire to obtain therefore, I use it directly when obtaining the value of the property. I use Try when attempting to access each built-in property because an error generates if the property contains no value. To do this, once again I use a foreach statement. $objHash = is time to work through the array of built in properties that I selected earlier. $BuiltinProperties = $document.BuiltInDocumentProperties I also create a hash table that I will use to create the custom object later in the script. Inside the foreach loop, I open each document,and return the BuiltInDocumentProperties collection. Now I need to walk through the collection of documents. $docs = Get-childitem -path $Path -Recurse -Include $include $application = New-Object -ComObject word.application $include = “Title”,”Author”,”Keywords”, “Number of words”, “Number of pages” This portion of the script is shown here. Finally, I obtain a collection of fileinfo objects and store the returned objects in the $docs variable. The reason for creating WdSaveOptions is to keep Word from modifying the last save option on the Word files. Next, I need to create BindingFlags and WdSaveOptions. Next, I create the Word.Application object and set it to be invisible. This permits changing the path to search, as well as modifying the include filter that is used by the Get-ChildItem cmdlet. The first thing I do is create a couple of command-line parameters. You should refer to those blogs for additional information. It is very difficult to work with Word document properties, and I have written several blogs about this. This is a great benefit because it permits further analysis and processing of the data-and it would even permit export to a CSV file if I wish. This script also accomplishes a few of the things I wanted to do in yesterday’s script that I did not get a chance to do-namely, I return a custom object that contains the built-in properties I choose. Today’s script is similar to the Find All Word Documents that Contain a Specific Phrase script from yesterday, so reviewing that posting would be a good thing to do.
#Custom document properties word 2016 full
Creates a custom Windows PowerShell object with each of the specified properties, in addition to the full path to the Word document.Retrieves the specific built-in Word properties and their associated value.The built-in Word properties are listed on MSDN.
:max_bytes(150000):strip_icc()/003-use-tags-to-organize-word-documents-3540109-df29d92b51b342008696b92d2487d680.jpg)

Searches a specific folder for Word documents.Well the script for today took a bit of work … actually it took quite a bit of work. Microsoft Scripting Guy, Ed Wilson, is here. Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to find specific built-in properties from Word documents.
