POWERSHELL / SHAREPOINT
FreeIntermediateRead-onlylow

Export SharePoint list inventory and item counts

Exports SharePoint non-document-list inventory and item counts using list metadata, avoiding an unsafe full-item crawl just to calculate counts.

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

What this PowerShell script does

Exports SharePoint non-document-list inventory and item counts using list metadata, avoiding an unsafe full-item crawl just to calculate counts.

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 list inventory and item counts in the Builder, review the generated PowerShell and run it in your own environment.

When to use this template

Inventories non-document-library lists and their metadata counts across selected sites. Document libraries belong to the separate document-library inventory.

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 list inventory and item counts →
OPS / SCRIPT DETAILS

Script details

Exports SharePoint non-document-list inventory and item counts using list metadata, avoiding an unsafe full-item crawl just to calculate counts. Review these details before generating or running the script.

sharepointlistsitem-countsinventorymigrationexport

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 non-document-library list metadata and count properties and does not load or change list items.

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, ListTitle, ListUrl, Id, BaseType, BaseTemplate, ItemCount, Hidden, ContentTypesEnabled, Status and Error.

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

Example use

Exports SharePoint non-document-list inventory and item counts using list metadata, avoiding an unsafe full-item crawl just to calculate counts.

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, choose hidden-list behavior, and use a new CSV output path.

Opselith quality checks

  • Included in the current Opselith PowerShell quality suite
  • Uses list metadata ItemCount rather than retrieving every item
  • Document libraries are excluded to keep the report distinct
  • Per-site failures are isolated and reported
  • Stable CSV output with formula-injection protection