Add SPO file version report and trim script for Teams sites#962
Open
fabianhutzli wants to merge 1 commit into
Open
Add SPO file version report and trim script for Teams sites#962fabianhutzli wants to merge 1 commit into
fabianhutzli wants to merge 1 commit into
Conversation
Introduces a block-based PnP PowerShell script to audit and clean up file version history across Microsoft Teams sites (including private channels). The script generates per-site version expiry reports, calculates storage savings, and triggers batch delete jobs with automatic versioning policy enforcement. Includes sample.json metadata with cmdlet tags and a detailed README covering the sequential block execution model and user context requirements for the version report and trim jobs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a block-based PnP PowerShell script to audit and clean up file version history across Microsoft Teams sites and their associated private channels. The script is structured for operational use in large environments: each block is executed sequentially and independently, with an optional batching mechanism for high site counts.
The script was born from a real-world need to reclaim SharePoint storage at scale while preserving control — operators can inspect projected savings before committing to any deletion.
Features
StorageReportlibrary on each site and triggersNew-PnPSiteFileVersionExpirationReportJobto generate a CSV of all file versions eligible for deletionNew-PnPSiteFileVersionBatchDeleteJob -Automaticand enforces automatic versioning policy viaSet-PnPSiteVersionPolicy$reportModeflag (defaulting to$true) prevents jobs from starting until explicitly set to$false$resultcan be split into named batch variables for incremental processing across large site inventoriesScript type
PnP PowerShell
Author
Fabian Hutzli