Tuesday 1 March 2011

How to remove a Feature (Event receivers/Workflow) from PowerShell

At some point, if you spend too much time developing workflows and event receivers, Visual Studio 2010 will probably crash when it is trying to retract the feature you are developing. You will normally get this error:

Error occurred in deployment step 'Recycle IIS Application Pool': Provider load failure sharepoint 2010

This error can be fixed in the following way (choose your favourite option, but I suggest the last one):

1- IIS RESET
* Go to the SharePoint Farm server.
* Start->Run...-> iisreset and pless enter.

2- RE-START YOUR SERVER

3- UNINSTALL THE FEATURE. (a)
* I normally list all the features to be sure that mine is there, try this command in powershell:
Get-SPFeature | Sort -Property DisplayName

* Get the Id of your feature (It is a GUID so it will look like something like this :0a1f6e15-7117-47d3-81d3-1681696e40f0)

*Now you have your ID, so just call this command
UnInstall-SPFeature -Identity yourid -force (ie: UnInstall-SPFeature -Identity 0a1f6e15-7117-47d3-81d3-1681696e40f0 -force)

4- UNINSTALL THE FEATURE. (b)
*If you know the name of the feature just apply this command (it is built from the previus one):

Get-SPFeature | Where-Object {$_.DisplayName -eq 'nameofthefeature'} | UnInstall-SPFeature -Identity {$_.Id} -force

No comments: