Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have deployed a solution with farm scope feature.

I am able to activate / deactivate feature via "Manage Farm feature".

I want to do this via power shell :

When i try to activate feature "Enable-SPFeature -Identity *14hive_featurefoldername* though this command exception is thrown:

Enable-SPFeature : Object reference not set to an instance of an object.

Whereas Disable-SPFeature feature work properly.

What am i missing in Enable-SPFeature statement?

share|improve this question
add comment

3 Answers

It seems the code in SPFeatureReceiver.FeatureActivated method is throwing this exception. Please check and correct the code in your Feature Receiver class.

share|improve this answer
1  
I also think this is the case. Check the ULS log, it definitely will contain the exception. –  Anita Boerboom Nov 2 '11 at 19:24
add comment

In my case I changed the scope from Web to Site in my Elements.xml of the feature. After I changed the scope back to Web, the Enable-SPFeature cmdlet worked perfect.

share|improve this answer
add comment

Did you try to identify the feature by its id (guid). this worked perfectly for me.

Enable-SPFeature -Identity [Guid]

If you don't know the Identity of the feature have a look at the properties in Visual Studio or use SP Manager 2010

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.