Tuesday, May 22, 2012

Modify sandbox code/solution execution timeout value using powershell

Default value of sandbox code/solution execution timeout is 30 seconds, there are times when one needs to increase this value to get complex code executed.

To view execution timeout value use following PS command-:

Write-Host $uc.ResourceMeasures["CPUExecutionTime"].AbsoluteLimit

Write-Host $uc.ResourceMeasures["CPUExecutionTime"].ResourcesPerPoint

To Modify above values use the following PS Commands-:


  1. Verify that you meet the following minimum requirements: See Add-SPShellAdmin.
  2. $uc=[Microsoft.SharePoint.Administration.SPUserCodeService]::Local
    $uc.ResourceMeasures["CPUExecutionTime"].AbsoluteLimit = <LimitValue>$uc.ResourceMeasures["CPUExecutionTime"].ResourcesPerPoint = <PointValue>$uc.ResourceMeasures["CPUExecutionTime"].Update()$uc.Update()
    Where:

    • <LimitValue>
    •  is the new maximum limit value.
    • <PointValue>
    •  is the new number of resources per resource point.


For more information on sandbox solutions refer to the this link.

Sunday, March 25, 2012

Unable to connect to configuration database

The main reason behind this exception is due the SharePoint server  inability to contact server. This may be due to
  • SQL server/Cluster is down,
  • Network is down.
  • SPN not configured properly
If all above are correct and SQL server box up and reachable using ping command from SharePoint servers, the go to command prompt and type the following command
C:\> IPCONFIG /flushdns

Type Services.msc in Start Menu--> Run and hit enter to open services mmc console.

Restart services named netlogon, dhcp client, and dns client.


Also if your server are VM boxes, then make sure system time in all servers are in sync with the server hosting active directory.

PowerPIvot for Sharepoint 2010 Installation/ Setup SharePoint 2010 Development box

Was never able to install this until Microsoft released Sharepoint 2010 service pack1.
All my previous SQL server installation used to fail because of the calls to integration dll.

Dev environment details-: This is single server farm installation
Windows 2008 R2 Enterprise, SQL Server 2008 R2 Enterprise, SharePoint Server 2010 Enterprise, Visual studio 2010 ultimate and MS office 2010 professional.
  • Install Windows 2008 R2 and activate it
  • Apply Windows 2008 R2 SP1
  • Configure Active directory using dcpromo command
  • Create domain accounts for SharePoint farm and other service applications and for SQL server too.
  • Install SharePoint server 2010 enterprise, but do not run product and technologies wizard. Remember to uncheck the checkbox at the finish of the SharePoint installation wizard.
  • Install SharePoint server 2010 SP1 (Download links to SP1 and other CUs are available here.
  • Install June 2011 cumulative update.
  • Restart the machine for any registry changes to take affect.
  • Start the installion SQL Server 2008 R2
  • Select PowerPivot for Sharepoint.
  • Select new Farm from the dropdown of SQL server installation wizard window.
  •  Enter Farm credentials, Passphrease, Central Administration port number, and other SharePoint related details.
  • Above details which you enter will be used by SQL server to configure SharePoint, basically what SharePoint product and technologies wizard.
  • Proceed by clicking next and let SQL server installation wizard configure Sharepoint and create database.
  • Once SQL server installation finishes successfully, Open central administration site and check it everything has been configured as the entries made by you during SQL installation.
  • Install Visual Studio 2010, ultimate edition and activate it.
  • Install Office 2010 Professional and activate it.
  • Optionally Install Visio 2010 Premium Edition if you want to create workflow that can be imported into SharePoint 2010.
  • Configure SSRS (SQL server reporting services) for Access services feature using Start Menu--> Programs-->Configuration Tools->SQL Server 2008 R2-->Reporting services configuration  Manager.
  • Post above step, configure SSRS association from central administration site.
  • Optionally install Office web apps in you need it.

Friday, February 17, 2012

State Service error while working with infopath forms on Sharepoint 2010 farm

You will get this error while working with infopath forms on a Sharepoint 2010 farm.
"The form cannot be rendered. This may be due to a misconfiguration of the Microsoft SharePoint Server State Service. For more information, contact your server administrator."

This happens because state service application has not been configured properly or it does not have a database and is not associated with default proxy settings. State service is used by SharePoint to store temporary objects.

Follow the steps below to create state service application instance, create database and associate it with default proxy


To create a service application, type the following command:
$serviceApp = New-SPStateServiceApplication -Name "State Service"

If State service already exists and there is no database for it. type the commands below to create one
$ServiceApp = Get-SPStateserviceapplication
New-SPStateServiceDatabase -Name "svcApp_StateService" -ServiceApplication $serviceApp

To associate the State service with default proxy, type in the command below..
New-SPStateServiceApplicationProxy -Name "State Service" -ServiceApplication $serviceApp -DefaultProxyGroup

Once this is done, error you are getting should be gone.








Thursday, February 9, 2012

Error details of correlation id using SQL queries

Execute the below query against the log database usually named as WSS_Logging unless we have changed to something else...


select [RowCreatedTime], [ProcessName], [Area],
[Category], EventID, [Message]
from [WSS_UsageApplication].[dbo].[ULSTraceLog]
 where CorrelationId='<GUID>'


Replace <guid> with correlation id.


Note-: Prior to executing the above query make sure that timer job name "Diagnostic Data Provider: Trace Log " job (you should see this at Central Admin -> Monitoring -> Review job Definitions) is enabled. If the dbo.ULSTraceLog view does not exist this job will create it.

Find error details of correlation ID using powershell

replace the <GUID> with the Correlation Id in below command

get-splogevent | ?{$_Correlation -eq "<GUID>" }

This will give you the details about your specific error like this in the console:
 if you would want these messages to be put into a text or log file instead, you could just add the classic output redirect tag as shown below...
“> C:\SPError.log” after the command like this:

get-splogevent | ?{$_.Correlation -eq "<GUID>"} | select Area, Category, Level, EventID, Message | Format-List > C:\SPError.log

Wednesday, February 8, 2012

clear blob cahce of all web apps using powershell


Below PowerShell script loops through all the web application in a farm and clears the blob cache. 


$WebAppColl = GET-SPWebApplication
foreach($WebApp in $WebAppColl )
{
                [Microsoft.SharePoint.Publishing.PublishingCache]::FlushBlobCache($WebApp)
Write-Host "Flushed the BLOB cache for:" $WebApp
$$WebApp.Dispose()
}
$WebAppColl.Dispose()