2

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

1 Answer 1

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)

}        
0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.