This script will help you to retrieve all the document libraries in Site Collection and will give details about the library using simple method.

Steps
  1. Open your SharePoint Management Shell.
  2. Copy the below code.
  3. Run this one.
Code

Load the below required libraries before we execute the code.
  1. [System.Reflection.Assembly]::Load("Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c")
  2. [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Portal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c")
  3. [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c")
  4. [System.Reflection.Assembly]::Load("System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
  1. function Get-DocReport([string]$siteUrl) {
  2. $SPsite = New-Object Microsoft.SharePoint.SPSite $siteUrl
  3. foreach ($web in $SPsite.AllWebs) {
  4. foreach ($list in $web.Lists) {
  5. if ($list.BaseType -eq "DocumentLibrary") {
  6. continue
  7. }
  8. foreach ($item in $list.Items) {
  9. $data = @{
  10. "Site" = $site.Url
  11. "Web" = $web.Url
  12. "list" = $list.Title
  13. "Item ID" = $item.ID
  14. "Item Title" = $item.Title
  15. "Created By" = $item["Author"]
  16. "Modified By" = $item["Editor"]
  17. "File Size (MB)" = $item.File.Length/1MB
  18. }
  19. New-Object PSObject -Property $data
  20. }
  21. }
  22. $web.Dispose();
  23. }
  24. $site.Dispose()
  25. }
  26. Get-DocReport "http://gowthamr.sharepoint.com" | Export-Csv -NoTypeInformation -Path "D:\OuputFolder\DetailReport.csv"
That's it. We are now good to go.