0

I have been trying to activate a custom feature with an event receiver by powershell, I am using the following command (I ran powershell as administrator)

Enable-SPFeature -Identity b6e1ccbb-e448-4aed-a303-1b0b900e3e90 -force -Url  $SubWeb.Url

The feature appears to be activated however the event receiver doesn't fire, When I activate it from UI it works perfectly

2
  • 1
    How do you know receiver is not executed? When you enable feature using PowerShell, receiver will be executed in powershell.exe process, not in w3wp.exe. Keep it in mind when you attach debugger to test it. Sep 29, 2015 at 6:37
  • @dstarkowski the event receiver fills a certain list with values I checked the list its empty after the command however when I activate it using ui it is filled properly Sep 29, 2015 at 7:49

1 Answer 1

0

You might be using variables which are not available/accessible in PowerShell but are available if you activate the feature via web (e.g. SPContext, etc.). The best thing would be to attach the debugger to powershel.exe as dstarkowski suggested and check what's wrong.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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