Is there any CSOM PowerShell code to check if a site collection feature is activated or not?
1 Answer
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)
}