Deactivates a feature or features at a given scope.

Disable-SPFeature2 [-PassThru [<SwitchParameter>]] -Identity <SPFeatureDefinitionPipeBind> [-Url [<String>]] [-Force [<SwitchParameter>]] [-IgnoreNonActive [<SwitchParameter>]] [-DeactivateAtScope [<Nullable`1>]] [-AssignmentCollection [<SPAssignmentCollection>]]




If provided, the cmdlet outputs the Feature definition object after disabling.


Specifies the name of the Feature or GUID to uninstall.

The type must be the name of the Feature folder located in the 14\Template\Features folder or GUID, in the form 21d186e1-7036-4092-a825-0eb6709e9281.


Specifies the URL of the Web application, site collection, or Web site for which the Feature is being deactivated.

The type must be a valid URL; for example, http://server_name.


Forces the deactivation of a Feature. This causes any custom code associated with the Feature to rerun.


Ignore scopes where the feature is not already activated.


Deactivate features at the specified scope only. Valid values are Farm, WebApplication, Site, Web, and Feature


Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.

When the Global parameter is used, all objects are contained in the global store. If objects are not immediately used, or disposed of by using the Stop-SPAssignment command, an out-of-memory scenario can occur.

Detailed Description

Deactivates a feature or features at a given scope.

Copyright 2016 Falchion Consulting, LLC

> For more information on this cmdlet and others:

> http://blog.falchionconsulting.com/

> Use of this cmdlet is at your own risk.

> Gary Lapointe assumes no liability.



PS C:\> Get-SPFeature MyFeature | Disable-SPFeature2 -Url "http://server_name" -IgnoreNonActive -DeactivateAtScope WebApplication

This example deactivates all occurences of MyFeature in the http://server_name web application.