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:// /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:

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