{"id":1732,"date":"2013-05-14T11:01:41","date_gmt":"2013-05-14T11:01:41","guid":{"rendered":"https:\/\/poiseddevelopers.com\/reality-tech\/?p=1732"},"modified":"2024-04-26T12:53:51","modified_gmt":"2024-04-26T12:53:51","slug":"report-on-every-library-in-a-sharepoint-farm","status":"publish","type":"post","link":"https:\/\/poiseddevelopers.com\/reality-tech\/report-on-every-library-in-a-sharepoint-farm\/","title":{"rendered":"Report on every library in a SharePoint Farm"},"content":{"rendered":"<h2>Report on every library in a SharePoint Farm<\/h2>\n<p>It is very useful to be able to examine attributes from every library in a SharePoint farm. Here\u2019s how to generate a report of useful library summary information, such as what level of versioning is enabled, which libraries are configured for QuickLinks and which have Content Types enabled, and how many documents are within each library. I use pipe-separated fields, in case commas are encountered in library fields, such as titles.<\/p>\n<pre lang=\"php\">\r\nAdd-PSSnapin \"Microsoft.SharePoint.PowerShell\" -ErrorAction SilentlyContinue\r\n$mylogfile=\"L:PowerShellCOREreportingLibSettings.csv\"\r\n \r\n$envrun=\"Prod\"          # selects environment to run in\r\nif ($envrun -eq \"Dev\")\r\n{\r\n$siteUrl = \"http :\/\/SharePoint Dev\/\"\r\n}\r\nelseif ($envrun -eq \"Prod\")\r\n \r\n{\r\n$siteUrl = \"http :\/\/SharePoint\/\"\r\n}\r\nelse\r\n{\r\nWrite-Host \"ENVIRONMENT SETTING NOT VALID: script terminating...\"\r\n$siteUrl =  $null;\r\nreturn;\r\n}\r\n \r\nWrite-Host \"script starting\"\r\n \r\n$myheader = \"STARTING: $(get-date)\"\r\n$Sep=\"|\"\r\nadd-content $mylogfile \"Site$($sep)Web$($sep)Library$($sep)FileCount$($sep)CTEnabled$($sep)VerMajor$($sep)VerMinor$($sep)QuickLaunch$($sep)MajVerLimit$($sep)MinorVerLimit$($sep)UniquePerms\"\r\n \r\n$WA=Get-spWebApplication $siteUrl;\r\nforeach ($site in $wa.sites)\r\n{\r\n  write-host $site.Url\r\nforeach ($web in $site.allwebs)\r\n{\r\n \r\n  if ($true) #useful placeholder for filtering. \r\n  {\r\n   Write-Host -foregroundcolor darkgreen \"$($site.id) - $($site.Url) - $($site.contentdatabase.id) - $($site.contentdatabase.name)\"  \r\n  \r\n \r\n   for ($i=0;$i -lt $web.Lists.Count;$i++)\r\n   { \r\n   $JPLib=$web.Lists[$i];\r\n   $A_Lib_Count++;\r\n   $SkipLib=$true; #true\r\n    \r\n   if ( ($JPlib.BaseType -ne \"DocumentLibrary\") -or ($JPlib.hidden) )\r\n    {\r\n      # forget the rest and return to top\r\n      Write-Host -foregroundcolor green \"fast test skipping Library: $($JPlib)\";   \r\n    }\r\n    elseif ($JPLib.Title -Match \"SitesAssets|Photo|Image|CustomizedsReports|Templates|Pages|Picture|cache|style|Slide\")\r\n    {\r\n      # forget the rest and return to top\r\n      Write-Host -foregroundcolor red \"fast test skipping Library because it mentions $Matches: $($JPlib)\";   \r\n    }\r\n    elseif ($JPLib.BaseTemplate -ne \"DocumentLibrary\")   #alternatively, only skip if -eq XMLForm\r\n    {\r\n      # forget the rest and return to top\r\n      Write-Host -foregroundcolor red \"fast skipping Library because it is not of base DocumentLibrary, it is BaseType:$($JPlib.basetemplate): $($JPlib.title)\";   \r\n    }\r\n    elseif (($JPLib.ThumbnailsEnabled) -or ($JPLib.DefaultView -eq \"AllSlides\"))\r\n    {\r\n      # forget any library with thumbnails, these are not normal doclibs, and return to top\r\n      Write-Host -foregroundcolor red \"fast test skipping Library because it has Thumbnails\/Slides $($JPlib)\";   \r\n    }\r\n    else\r\n    {  $SkipLib=$false; }\r\n      \r\n    if (!$SkipLib)\r\n    {\r\n      #write-Host -foregroundcolor green \"Processing Library: $($JPlib)\";   \r\n \r\n      $LineOut = \"$($site.url)$($sep)$($web.title)$($sep)$($JPLib.title)$($sep)$($JPLib.items.count)$($sep)$($JPLib.ContentTypesEnabled)$($sep)$($JPLib.get_EnableVersioning())$($sep)$($JPlib.get_EnableMinorVersions())$($sep)$($JPLib.OnQuickLaunch)$($sep)$($JPLib.MajorVersionLimit)$($sep)$($JPLib.MajorWithMinorVersionsLimit)$($sep)$($JPLib.HasUniqueRoleAssignments)\"\r\n      Write-Host $lineOut\r\n    add-content $mylogfile $LineOut\r\n    }\r\n     \r\n    }\r\n    \r\n} #foreach site\r\n} #if $true\/Siteurl is not null, if environment setup is valid\r\n} #foreach letter\r\n###########################\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Report on every library in a SharePoint Farm It is very useful to be able to examine attributes from every library in a SharePoint farm. Here\u2019s how to generate a report of useful library summary information, such as what level of versioning is enabled, which libraries are configured for QuickLinks and which have Content Types [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":1734,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[32],"tags":[],"class_list":["post-1732","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sharepoint"],"acf":[],"_links":{"self":[{"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/posts\/1732","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/comments?post=1732"}],"version-history":[{"count":1,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/posts\/1732\/revisions"}],"predecessor-version":[{"id":1738,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/posts\/1732\/revisions\/1738"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/media\/1734"}],"wp:attachment":[{"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/media?parent=1732"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/categories?post=1732"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/tags?post=1732"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}