Skip to content

Instantly share code, notes, and snippets.

Created December 27, 2017 14:27
What would you like to do?
#region Variables
$siteUrl = "http://sharepoint2013/organization/Nav_Rep_WithoutVariation_De"
$featureID = [GUID]("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")
#region Add references to SharePoint client assemblies - required for CSOM
Add-Type -Path "Microsoft.SharePoint.Client.dll"
Add-Type -Path "Microsoft.SharePoint.Client.Runtime.dll"
$context = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)
$web = $context.Web
$siteFeatures = $context.Site.Features
$siteFeatures.Add($featureID, $true, [Microsoft.SharePoint.Client.FeatureDefinitionScope]::None)
Write-Host "Feature '$featureID' successfully activtated by '$siteUrl' "
Write-Host "No activated by '$item.Name'"
Read-Host "Press enter key to continue"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment