Scenario/Problem: You need to deactivate a feature.
Solution: Use the Disable-SPFeature
cmdlet with a feature variable.
The Disable-SPFeature
cmdlet enables you to deactivate a feature at the determined level. Use this in conjunction with the Get-SPFeature
cmdlet (explained in a previous section), as shown in Listing 9.23.
$feature = Get-SPFeature
-Identity e8389ec7-70fd-4179-a1c4-6fcb4342d7a0
Disable-SPFeature $feature -Url "http://sp2013" -Force
The -Url
parameter is either the web application, site collection, or the site in which the feature should be activated. At the root level of the main site, the address is the same. Features can be deactivated only at the level where they reside and are activated.
The -Force
switch parameter forces the deactivation and does not produce any errors if the feature is already deactivated.
Note
To disable farm features, do not provide a –Url
parameter.
18.191.5.239