Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top