2

Is there any CSOM PowerShell code to check if a site collection feature is activated or not?

3

There can be better and different ways to check if Feature is activated or not. But once I used below code.

Connect to your site collection using CSOM code, and load feature as below.

$FeatureID = "000-000000-0000" #GUID of your feature
$SiteFeatures = $context.Site.Features 
$context.Load($SiteFeatures)
$context.ExecuteQuery()

$IsFeatureExists = $SiteFeatures | Where {$_.DefinitionID -eq $FeatureID}

if ($IsFeatureExists)
{
    # Feature Exist (Activated)
}
else
{
    # Feature do not exist (Not Activated)

}        

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.