Powershell report to capture site collections to list/library items

Shri-6058 326 Reputation points
2021-03-16T05:26:52.677+00:00

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

SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,221 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,573 questions
SharePoint Server Management
SharePoint Server Management
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Management: The act or process of organizing, handling, directing or controlling something.
2,799 questions
{count} votes

1 answer

Sort by: Most helpful
  1. MichaelHan-MSFT 18,016 Reputation points
    2021-03-17T03:08:05.63+00:00

    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.

    0 comments No comments