POWERSHELL / SHAREPOINT
FreeIntermediateRead-onlylow

Export SharePoint document library inventory

Exports SharePoint document library metadata, counts and migration-relevant settings without crawling every file or item.

Generated locally in your browser · Runs in your PowerShell environment · Review before running

What this PowerShell script does

Exports SharePoint document library metadata, counts and migration-relevant settings without crawling every file or item.

Requirements

  • Scope - Choose one SharePoint site or a CSV containing a SiteUrl column. (Required)
  • SharePoint site URL - Required for single-site scope. (Conditional)
  • Site list CSV path - CSV must contain a SiteUrl column. Duplicate URLs are ignored. (Conditional)
  • Entra app client ID - Your PnP app client ID. Leave empty only when a PnP default client ID is already configured. (Optional)
  • Include hidden lists/libraries - Include hidden SharePoint lists or libraries. Leave disabled for the normal admin inventory. (Optional)
  • CSV output path - Use a new absolute Windows CSV path. (Required)

Environment

  • Module: PnP.PowerShell
  • Runtime: 7.4+
  • Authentication: Interactive PnP login with your own Entra app/client ID or configured default
  • Permissions: AllSites.Read
  • Risk: Low
Review before you run The generated script is read-only, but authentication and access requirements still apply in your tenant.
OPS / WORKSPACE

Ready to generate

Configure Export SharePoint document library inventory in the Builder, review the generated PowerShell and run it in your own environment.

When to use this template

Reads document libraries from one or more selected sites and uses SharePoint list metadata for counts and configuration. It does not enumerate documents just to calculate totals.

Important limitations

PowerShell and PnP requirements

Current PnP.PowerShell releases require PowerShell 7.4 or later. Interactive authentication requires your own Entra application/client ID, or a default client ID that you have configured for PnP.PowerShell. Opselith does not connect to SharePoint or run the script on your behalf.

Generate the script

  1. Open the template in the PowerShell Builder.
  2. Enter the requested URLs, client ID (when needed) and a new CSV output path.
  3. Generate the script, review its permissions and commands, then run it in your own PowerShell environment.
Generate Export SharePoint document library inventory →
OPS / SCRIPT DETAILS

Script details

Exports SharePoint document library metadata, counts and migration-relevant settings without crawling every file or item. Review these details before generating or running the script.

sharepointdocument-librarylibrariesinventorymigrationexport

What it works with

Module: PnP.PowerShell

Context: PowerShell 7.4+ · SharePoint Online · PnP.PowerShell

Compatibility: PowerShell 7.4+ is required by current PnP.PowerShell releases.

Permissions and impact

Permissions: AllSites.Read

Risk: Low

Execution impact: Read-only. The script reads document-library metadata and item-count properties and does not enumerate, download or change documents.

Parameters

  • Scope - Choose one SharePoint site or a CSV containing a SiteUrl column. (Required)
  • SharePoint site URL - Required for single-site scope. (Conditional)
  • Site list CSV path - CSV must contain a SiteUrl column. Duplicate URLs are ignored. (Conditional)
  • Entra app client ID - Your PnP app client ID. Leave empty only when a PnP default client ID is already configured. (Optional)
  • Include hidden lists/libraries - Include hidden SharePoint lists or libraries. Leave disabled for the normal admin inventory. (Optional)
  • CSV output path - Use a new absolute Windows CSV path. (Required)

Output

Output: CSV report with SiteUrl, LibraryTitle, LibraryUrl, Id, ItemCount, Hidden, EnableVersioning, EnableMinorVersions, ContentTypesEnabled, ForceCheckout, Status and Error.

This template is available in the free library and is generated locally in your browser.

Example use

Exports SharePoint document library metadata, counts and migration-relevant settings without crawling every file or item.

Enter the required values in the Builder, review the generated script and confirm the output before running it.

Before you run: Use PowerShell 7.4+ with PnP.PowerShell and interactive authentication. Select one site or a SiteUrl CSV, decide whether hidden libraries should be included, and choose a new CSV output path.

Opselith quality checks

  • Included in the current Opselith PowerShell quality suite
  • Uses list metadata ItemCount instead of loading every item
  • Hidden-library behavior is explicit
  • Per-site failures are isolated and reported
  • Stable CSV output with formula-injection protection