Thursday, October 21, 2010

Errors when Starting SharePoint User Code Service (aka Sandboxed Code) with Powershell

The Short:
The service account used to host the SharePoint User Code Service needs to be added to the Performance monitors group on the server running the service.

The Story:
Recently, I was working on installing some SharePoint 2010 Farms using powershell, and I kept seeing errors when starting the SharePoint User Code (aka Sandboxed Code) Service. After installing the farm, the SharePoint 2010 User Code Host windows service was stopped, and the following errors appeared in the event log:


- "The SharePoint 2010 User Code Host service terminated unexpectedly"

After looking through the ULS logs on the server, I noticed errors around calls to the performance counters on the machine. It turns out that the user account that is used for the User Code Service needs additional permissions on the machine running the service. Specifically, the account to be added to the Performance Monitor Users group.

The issue only appears to be an issue when starting the service from powershell specifically because when started from central administration, the user account defaults to the Farm account, and that account is automatically added to the correct group.

More error details can be found at http://support.microsoft.com/kb/983081/en-US, but the kb article does not specify the group required.

I hope this helps someone out there!

2 comments:

Unknown said...

Thanks a ton! This has been killing me.

Benjamin Rutledge said...

Thanks for your help with tuning. This was the right answer for a big part of my problem.