$uc.ResourceMeasures.Update()
==================================================
# Give our sandboxed solution more resources.
# Worker Process Timeout
$wpe = "900"
# CPU Timeout
$cpu = "900"
# Grab the User Code Service
$uc=[Microsoft.SharePoint.Administration.SPUserCodeService]::Local
# Output current values
Write-Host ""
Write-Host "Current worker process execution timeout is:" $uc.WorkerProcessExecutionTimeout "seconds" -foreground cyan
Write-Host "Current CPU execution timeout is:" $uc.ResourceMeasures["CPUExecutionTime"].AbsoluteLimit "seconds" -foreground cyan
Write-Host ""
Write-Host " ***UPDATING***"
Write-Host ""
# Update worker process execution timeout
$uc.WorkerProcessExecutionTimeout = $wpe
# Update CPU execution time
$uc.ResourceMeasures["CPUExecutionTime"].AbsoluteLimit = $cpu
$uc.ResourceMeasures.Update()
# Update User Code Service
$uc.Update()
# Output new values
Write-Host "New worker process execution timeout is:" $uc.WorkerProcessExecutionTimeout "seconds" -foreground green
Write-Host "New CPU execution timeout is:" $uc.ResourceMeasures["CPUExecutionTime"].AbsoluteLimit "seconds" -foreground green
Write-Host ""
Write-Host "Now go and restart the sandboxed code service on all servers!!!"
Stop-Service SPUserCodeV4
Start-Service SPUserCodeV4
# Worker Process Timeout
$wpe = "900"
# CPU Timeout
$cpu = "900"
# Grab the User Code Service
$uc=[Microsoft.SharePoint.Administration.SPUserCodeService]::Local
# Output current values
Write-Host ""
Write-Host "Current worker process execution timeout is:" $uc.WorkerProcessExecutionTimeout "seconds" -foreground cyan
Write-Host "Current CPU execution timeout is:" $uc.ResourceMeasures["CPUExecutionTime"].AbsoluteLimit "seconds" -foreground cyan
Write-Host ""
Write-Host " ***UPDATING***"
Write-Host ""
# Update worker process execution timeout
$uc.WorkerProcessExecutionTimeout = $wpe
# Update CPU execution time
$uc.ResourceMeasures["CPUExecutionTime"].AbsoluteLimit = $cpu
$uc.ResourceMeasures.Update()
# Update User Code Service
$uc.Update()
# Output new values
Write-Host "New worker process execution timeout is:" $uc.WorkerProcessExecutionTimeout "seconds" -foreground green
Write-Host "New CPU execution timeout is:" $uc.ResourceMeasures["CPUExecutionTime"].AbsoluteLimit "seconds" -foreground green
Write-Host ""
Write-Host "Now go and restart the sandboxed code service on all servers!!!"
Stop-Service SPUserCodeV4
Start-Service SPUserCodeV4
No comments:
Post a Comment