This script removes the Sandbox mode for a SharePoint 2010 Service (example: Word Automation Service).

It can be helpful when you have issues with a Service which have its worker process running in the sandbox mode (IsSandBoxed: True).

The issue in the log can be something like that:

AppWorker:89d80fff-43ec-459e-9d95-5ed8b67f20bb worker process is started Exe: WordServerWorker.exe Args: /id 89d80fff-43ec-459e-9d95-5ed8b67f20bb /convertingService net.pipe://127.0.0.1/WordServer71cf62b9-c34c-46c4-9828-55de2d5f5ac0 /assembly WdsrvWorker.dll /type WACWS /IsBatchedTracing True /LogQuota 100 WorkerType: WorkerType1 Directory: c:\windows\system32\inetsrv, pid : 3700, IsSandBoxed: True, UniqueSandBoxSid:S-1-5-26473-19571-45394-48

The script:

PowerShell
Edit|Remove
$sp = Get-SPServiceApplication | where {$_.TypeName.Equals("Service Name")}  
$sp.DisableSandbox = $true 
$sp.Update()