<#
.SYNOPSIS
Activating WebApplication level features if not already activated
.PARAMETER Url
The URL of the web application
.PARAMETER featureID
ID of feature which need to be activated
#>
param
(
[parameter(Mandatory=$true)][string]$Url,
[parameter(Mandatory=$true)][string]$featureID
)
#Activate web application Feature
#----------------------------------------------------
$webApplication = Get-SPWebApplication -Identity $Url
#Check whether Feature to be activated is already activated
$feature = Get-SPFeature -WebApplication $webApplication | where {$_.Id -eq $fatureID}
if ($feature)
{
Write-Host "feature with ID" $fatureID "is already activated"
}
else
{
Enable-SPFeature -Identity $fatureID -Url $webApplication.url
Write-Host "feature with ID" $fatureID "has been activated at :" $webApplication.url
}Small PowerShell snippet which will check whether the WebApplication level feature is activated or not. If feature is not activated then feature will be activated.
