Powershell script to enable Sandbox solution on Domain Controller

If your SharePoint 2010 development machine is also a domain controller then by default Sandbox solutions are disabled on it. To enable it, you need to run the following powershell script:

$acl = Get-Acl HKLM:\System\CurrentControlSet\Control\ComputerName
$person = [System.Security.Principal.NTAccount]“Users”
$access = [System.Security.AccessControl.RegistryRights]::FullControl
$inheritance = [System.Security.AccessControl.InheritanceFlags]“ContainerInherit,ObjectInherit”
$propagation = [System.Security.AccessControl.PropagationFlags]::None
$type = [System.Security.AccessControl.AccessControlType]::Allow
$rule = New-Object System.Security.AccessControl.RegistryAccessRule($person, $access,$inheritance, $propagation, $type)
$acl.AddAccessRule($rule)
Set-Acl HKLM:\System\CurrentControlSet\Control\ComputerName $acl

Just copy the above code in a text file and save it as EnableSandbox.ps1.
Execute the file through powershell.
Enjoy!

Share