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

When executing Install-SPUserSolution powershell command the following error is shown:

Install-SPUserSolution : Sandboxed code execution request failed. At line:1 char:23 + Install-SPUserSolution <<<< -Identity some_package.wsp -Site http://localhost/sites/test + CategoryInfo : InvalidData: (Microsoft.Share...allUserSolution: SPCmdletInstallUserSolution) [Install-SPUserSolution], SPUserCodeExecu...F ailedException + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletInstallU serSolution

When I try to activate the user solution from the SharePoint interface everything works fine. So this doesn't work only from PowerShell. I tried to run user code service under different account (admin account) but this didn't help. Currently this service is running under Network Service account.

Also when I run Add-SPUserSolution or Uninstall-SPUserSolution they work just fine. I was able to reproduce this issue on at least two servers. Please advice.

share|improve this question
add comment

1 Answer 1

I had this same problem on a new SharePoint farm. The solution I was deploying worked in many other farms, so I knew it must be some type of configuration problem. It would deploy from the solution gallery in the browser, but not from PowerShell.

To get it to work, I did the following:

Created a new managed account.

Stopped the Windows service "SharePoint 2010 User Code Host". In the past I've had trouble with the service credentials being updated if the service is running.

Assigned the new managed account to "Windows Service - Microsoft SharePoint Foundation Sandboxed Code Service" and confirmed the Windows service was updated with the new credentials.

Confirmed the managed account was added to the local Windows group WSS_WPG. I also added it to:

  • WSS_ADMIN_WPG
  • Performance Log Users
  • Performance Monitor Users

In Central Admin "Manage Web Applications", confirmed managed account was added with "Full Control, Full Read" to User Policy settings for web application.

Rebooted the server.

share|improve this answer
    
Unfortunately still the same error. But I tested with the brand new wsp which has only content type definition and it worked using powershell. Then I added just an Event Receiver with all methods commented and the powershell failed. So probably there should be some attribute or something on the event receiver. What do you think? –  Maxim Ozerov Dec 12 '12 at 15:56
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.