#Config Variable
$SiteURL = "https://test.sharepoint.com/sites/HR-EngagementChamps/"
$FeatureId = "f6924d36-2fa8-4f0b-b16d-06b72890180fa" #Site Scoped Publishing Feature
#Connect to PNP Online
Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)
#get the Feature
$Feature = Get-PnPFeature -Scope Site -Identity $FeatureId
#Get the Feature status
If($Feature.DefinitionId -eq $null)
{
#Activate the Feature
Write-host -f Yellow "Activating Feature..."
Enable-PnPFeature -Scope Site -Identity $FeatureId -Force
Write-host -f Green "Feature Activated Successfully!"
}
Else
{
Write-host -f Yellow "Feature is already active!"
}



No comments:
Post a Comment