Edit ResourceMeasures such as AbsoluteLimit for SPUserCodeService with PowerShell

There are plenty of other posts out there that do an excellent job of explaining the concept of Sandboxed solutions and absolute limits so I’m not going to re-hash what others have done well. What I haven’t seen is a good explanation of how to update / change / modify the values of the ResourceMeasures like the AbsoluteLimit or AbnormalProcessTerminationCount and others using PowerShell.

TechNet lists what the default quotas are for each measure so there is no need to duplicate it but I will list each measure in case people are looking for them. Check out http://technet.microsoft.com/en-us/library/ff603636.aspx for more information.

Measures –

Here is the PowerShell commands I used to change the values –
PS C:\ >$spcode = [Microsoft.SharePoint.Administration.SPUserCodeService]::Local

//This command will cache “[Microsoft.SharePoint.Administration.SPUserCodeService]::Local” so you don’t have to keep typing it.

PS C:\> $spcode.ResourceMeasures | select name, ResourcesPerPoint, AbsoluteLimit
//This will display a list of ResourceMeasures and their current ResourcesPerPoint and AbsoluteLimits, I am showing these values since they were the ones I needed to modify.

SPUserCode AbsoluteLimit Update 1

PS C:\>  $abnormal = $spcode.ResourceMeasures[“AbnormalProcessTerminationCount”]

//This will cache the ResourcesMeasure AbnormailProcessTerminationCount

PS C:\>  $abnormal.ResourcesPerPoint = 10

PS C:\> $abnormal.AbsoluteLimit = 20

//Please note that I am not actually advocating or recommending that these values be changed especially so drastically.

PS C:\> $abnormal.Update($True)

//This will commit the changes you’ve made. This is also the command that seems to be missing from other instructions I’ve seen online.

PS C:\>$spcode.ResourceMeasures | select name, ResourcesPerPoint, AbsoluteLimit

//To view the changes you have made.

SPUserCode AbsoluteLimit 2

Hopefully others will find this useful.


About Mr_SHeister

Geek, Dad, SharePoint Administrator
This entry was posted in Uncategorized and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s