Deactivate a Feature
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.
Listing 9.23. Sample Script for Deactivating a Feature
$feature = Get-SPFeature-Identity e8389ec7-70fd-4179-a1c4-6fcb4342d7a0Disable-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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access