question

Shri-6058 avatar image
0 Votes"
Shri-6058 asked ·

Powershell report to capture site collections to list/library items

I am in a process of writing script for SharePont 2013 On premises report using Powershell to collect very detailed level such as web applications, site collections, subsites, list and libraries and list and library items. I tried various scripts it seems providing list and library are the last level. Is there any scripts available to cover sitewise details such as site level, permission for the site, list, list items and library, library items and so on for the full web application.

Appreciate any direction.

Shri

office-sharepoint-server-administrationoffice-sharepoint-server-developmentoffice-sharepoint-server-customization
· 1
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @Shri-6058 ,

Is there anything update? Have you tried the script I provided?

If my answer helps you, you could accept it as answer, it will also be helpful to others who have similar issues in the future.

0 Votes 0 ·

1 Answer

MichaelHan-MSFT avatar image
0 Votes"
MichaelHan-MSFT answered ·

Hi @Shri-6058 ,

You could try the below script to get the report on all list/library items for web application:

 Add-PSSnapin "Microsoft.SharePoint.PowerShell"
 $webapplication=get-spwebapplication http://sp16
 $sites=$webapplication.sites
 $collection=@()
 foreach($site in $sites){
     foreach($web in $site.allwebs){
         $lists=$web.lists | where Hidden -eq $False
         foreach($list in $lists){
             $list.items | foreach {
                 $ExportItem = New-Object PSObject
                 $ExportItem | Add-Member -MemberType NoteProperty -name "Site" -value $site.url
                 $ExportItem | Add-Member -MemberType NoteProperty -name "Web" -value $web.url
                 $ExportItem | Add-Member -MemberType NoteProperty -name "List" -value $list.Title
                 $ExportItem | Add-Member -MemberType NoteProperty -name "Id" -value $_.id
                 $ExportItem | Add-Member -MemberType NoteProperty -name "Title" -value $_["Title"]
                 $ExportItem | Add-Member -MemberType NoteProperty -name "FileRef" -value $_["FileRef"]
                 $collection += $ExportItem
             }
         }
     }
 }
  $collection | Export-CSV "c:\Report.csv" -NoTypeInformation   


If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.