Sample scripts for the PnP PowerShell cmdlets. These scripts were developed by myself and used in real-life scenarios, but are often kept simple (e.g., they usually don't use parameters; variables are set directly in the script) and can be expanded/update if wanted. Feel free to submit Issues or Pull Requests to improve them
Script | Description |
---|---|
GetListDetails | This script creates an inventory of the lists and libraries in a site, similar to what's available in the Site Contents page |
GetVersioningDetails | This script retrieves all versioning details from all lists in a provided site, including 'Require Content Approval','Versioning Enabled','Major Version limit','Draft Version limit', 'Drafts visible to', and 'Checkout required' |
VerifyListForms | This script checks all lists in all subsites and verifies if the lists have the three forms (View, Edit, New) set. If at least one of them is not available, the script will log the list to a report file |
UpdateListIcon | This script replaces any older list icon references (e.g. used in older versions of SharePoint) to the current .png version |
Script | Description |
---|---|
UpdateContentType | This function updates all items in a given list/library from one content type to another |
GetItemVersionHistory | This script retrieves the version history of a specific item in a specified list. Field changes can be tracked by manually updating the script to include those fields |
Script | Description |
---|---|
GetPermissionLevels | Retrieves the permission levels from all site collections (excluding OneDrive) and stores them in a CSV file |
SetSiteCollectionAdministrators | Sets a list of site collection administrators on specified sites (selected via filter) in the current tenant |
Script | Description |
---|---|
SetSearchIndexing | This script sets the "Indexing Site Content" setting under "Search and Offline Availability" |
SetSiteCollectionSearchSettings | This script sets the search center URL as well as the seach results page URL for a given site collection |
Script | Description |
---|---|
GetSiteCollectionStorageDetails | Retrieves size information for all site collections in a tenant and exports it to a CSV file |
RecursivelyDeleteSubsites | This script recursively deletes all subsites for a given site and the site itself |