I have a need to check through a site collection and find all password protected office documents. My organisation has decided on a policy where password protection on documents will no longer be allowed and I've been given the task of finding them. Is there a way to do this in Powershell. I suspect it has something to do with the checking of file attributes but every example I have come across relates to reading from a network drive. Can this be done in sharepoint?
The solution below will work for encrypted files in Office 2007 and later OpenXML format. If you have Office 97-2003 or other format files you will need to add tests for these.