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 ...

Get PowerShell™ for SharePoint® 2013 How-To now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.