Document Inventory PowerShell Script

The other day I had a request to get a list of all documents in a web application and some information about each document. From here I was able to open the file in Excel and create a PivotTable of each site collection, site, and library, and get counts of the versions and unique permissions for each. In this case a few of the libraries were approaching the 50,000 unique security scope limit in a list/library…be careful of that limit¬†(Described here: http://technet.microsoft.com/en-us/library/cc262787(v=office.15).aspx#ListLibrary)! Here is the script:

Additional Notes: