I have a .wsp file that is deployed to the remote server by powershell script. The solution is deployed successfully and I can see the solution feature in the site collection features, I can activate this feature thru SharePoint UI, but I need activate it by powershell script.

I found that I should to use Enable-SPFeature command. In the Automating SharePoint 2010 with Windows PowerShell book says that this command is applays to features deployed via Farm and sendbox solution.

But when I tries to use command for my sandbox solution feature:

Enable-SPFeature featureName -Url siteUrl

I have following exception:

Enable-SPFeature : The Feature is not a Farm Level Feature and is not found in a Site level defined by the Url http://p s129-m. At line:1 char:17 + enable-spfeature <<<< "featureName" -Url "siteUrl" + CategoryInfo : InvalidData: (Microsoft.Share...etEnableFeature:SPCmdletEnableFeature) [Enable-SPFeature ], SPCmdletException + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletEnableFeature

How can I activate sandbox solution feature on the remote server by powershell script?

  • (deleted my previous coment, I'm not sure of how the feature folder name is managed in an user solution) Have you already tried to use the feature GUID instead of the feature name? That way we should be able to determine if the error is caused by the powershell sintax or some other issue.
    – SPArcheon
    Oct 21, 2011 at 14:08
  • thanks for advice! I tried to use the feature GUID instead of the feature name, and it works.
    – Alexander
    Oct 21, 2011 at 14:17

2 Answers 2


When you use the Enable-SPFeature cmdlet, you have two way to specify the feature you want to update:

  • specify the folder name of the feature or
  • specify the feature GUID identifier

In your case I can only assume that the name you are using isn't recognized as the folder name of the feature you are trying to activate. To be honest, I don't know if in case of user solutions the folder name should work by specifing the name of the folder in the wsp package, so I would just use the GUID if that is a viable solution.

On the other and you could try and unzip the wsp package (it is a cab archive afterall) and confirm if you were using as the feature name the name of the feature folder in the package.

I will try to see if i can confirm the "format" to use for the feature name in case of user solutions (msdn only seems to consider features deployed to the 14 folder) and update this answer with any additional finding.

  • 1
    A little curiosity here for the interested: Since SPFeatureDefinition that is used by Enable-SPFeature uses SPFarm when it Read()'s the pipebind, it obviously cant really be used for sandboxed solutions. This triggered my curiosity to find out why it actually works (as it does) for -Identity <guid>. It turns out that in InternalValidate() of the cmdlet a SPCmdletPipeBindException is swallowed(!) and SPSitePipeBind is used to fetch site, and then a specific Read(SPSite siteScope, bool sandboxedFeatureDefinitions) is called. Jun 19, 2012 at 10:30
  • ^_^'... aka the "try-catch-swallow" pattern... I don't know why, but I'm NOT surprised... Anyway, nice find @AndersRask
    – SPArcheon
    Jun 20, 2012 at 7:13
  • yeah you don’t want to swallow exceptions to determine flow control :-S At least its not expensive in newer versions of C# (as long as you dont throw) Jun 20, 2012 at 8:16

After a usersolution (a sandboxed solution) is added to the solution gallery with Add-SPUserSolution it can be installed (activated) with Install-SPUserSolution.

  • I did these steps. The solution is added and activated correctly. In the next step I tries to activate my feature that is provided by the sanbox solution. But I retrieves the exception.
    – Alexander
    Oct 21, 2011 at 14:11
  • I cannot even see the web site scoped level features through get-spfeature
    – Roman
    Mar 15, 2012 at 21:50

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.