Enabling and Managing Site Features using PnP PowerShell

Loading

SharePoint Online provides various site features that can be activated or deactivated to extend site functionalities. Using PnP PowerShell, SharePoint administrators can:

Enable or disable site features
Check active features on a site
Automate feature activation for multiple sites

Examples of site features:
Publishing Infrastructure
SharePoint Server Enterprise Features
Site Pages
Team Collaboration Lists


Prerequisites

Before enabling or managing features, ensure:

PnP PowerShell is installed

Install-Module -Name PnP.PowerShell -Force -AllowClobber

You are connected to SharePoint Online

Connect-PnPOnline -Url "https://yourtenant.sharepoint.com/sites/YourSite" -Interactive

You have SharePoint Admin or Site Collection Admin permissions


Step 1: Checking Active Features on a SharePoint Site

To list all active site features:

Get-PnPFeature -Scope Web

Displays all active features at the site level.

To check site collection-level features:

Get-PnPFeature -Scope Site

Lists site collection features that are currently active.


Step 2: Enabling a SharePoint Site Feature

To enable a specific feature, use its Feature ID:

Enable-PnPFeature -Identity "Feature-GUID" -Scope Web -Force

Activates the feature at the site level.

Example: Enable Publishing Infrastructure

Enable-PnPFeature -Identity "f6924d36-2fa8-4f0b-b16d-06b7250180fa" -Scope Site -Force

Enables the SharePoint Server Publishing Infrastructure for the site collection.


Step 3: Disabling a SharePoint Site Feature

To disable a site feature, run:

Disable-PnPFeature -Identity "Feature-GUID" -Scope Web -Force

Deactivates the specified feature at the site level.

Example: Disable SharePoint Server Enterprise Features

Disable-PnPFeature -Identity "b50e3104-6812-424f-a011-cc90e6327318" -Scope Site -Force

Removes Enterprise Features, like InfoPath Form Services and Excel Services.


Step 4: Automating Feature Activation for Multiple Sites

To activate a feature for multiple SharePoint sites:

$sites = @(
"https://yourtenant.sharepoint.com/sites/Site1",
"https://yourtenant.sharepoint.com/sites/Site2",
"https://yourtenant.sharepoint.com/sites/Site3"
)

foreach ($site in $sites) {
Connect-PnPOnline -Url $site -Interactive
Enable-PnPFeature -Identity "f6924d36-2fa8-4f0b-b16d-06b7250180fa" -Scope Site -Force
Write-Host "Feature enabled on $site" -ForegroundColor Green
}

Enables Publishing Infrastructure on all listed sites.


Step 5: Exporting Active Features Report

To generate a CSV report of active features:

$features = Get-PnPFeature -Scope Web | Select DisplayName, Id
$features | Export-Csv -Path "C:\ActiveFeaturesReport.csv" -NoTypeInformation

Saves the list of active features into a CSV file.


Step 6: Troubleshooting Common Issues

1️⃣ Feature Not Activating?

Ensure you have the correct Feature ID (GUID).
Verify you have Admin Permissions for the site.

2️⃣ PnP PowerShell Commands Not Working?

Run Update-Module PnP.PowerShell to ensure the latest version.
Check if the feature is already enabled using Get-PnPFeature.

Leave a Reply

Your email address will not be published. Required fields are marked *