Friday, February 17, 2012

PowerShell Scripting - SharePoint 2010 cmdlets

Hi Folks,

Following are the some useful Powershell cmdlets for reference

Script to Remove SharePoint 2010 Search Service Application

$SearchServiceApplication = Get-SPServiceApplication |?{$_Name -eq "Search Service Application"}
Remove-SPSericeApplication -Identity $SearchServiceApplication.Id -RemoveData

If it Still didn't work, you can you the following command

stsadm.exe deleteconfigurationobject -id "GUID of the SearchService Application"

To obtain the GUID of the Search Service Application From the UI Navigate to the service applications page. Mouse-over the search application link, and observe the id in the status bar.


Remove Database reference

Get-SPDatabase | ft Name, Id

$DatabaseToDelete = Get-SPDatabase {GUID of the database to delete}
$DatabaseToDelete | ft Name, Id
$DatabaseToDelete.Delete()

Get-SPDatabase | ft Name, Id


DeleteService Applicaqtion Application pool

Get-SPServiceApplicationPool | Select Id, Name

$AppPoolToDelete = Get-SPServiceApplicationPool -Identity "NameOfTheServiceApplicationPool"

Remove-SPServiceApplicationPool $AppPoolToDelete

Get-SPServiceApplicationPool | Select Id, Name

ShrarePoint Search 2010 Administration Component not responding

Hi Folks,

I ran the following ugly error in SharePoint 2010 Search Administration Screen today. After lot of googling, many suggested to rebuild the farm, re-run configuration wizard, re-create search application. But the error can be resolved by the Simple stsadm command

Scenario: Search is not working, Admin Components couldn't connect and not able to view the topology

Problem: The search service is not able to connect to the machine that hosts the administration component. verify that the administration component '########-####-####-####-###########' in search application 'search service application' is in a good state and try again.

Resolution: Run the following stsadm command

stsadm -o provisionservice -action start -servicename osearch14 -servicetype "Microsoft.Office.Server.Search.Administration.SearchService, Microsoft.Office.Server.Search, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"

do a simple iisreset /noforce

Thats it!!! it will start working!!!

Happy Code Fix!!!!

Tuesday, February 14, 2012

SharePoint 2010 Search Administration Reports Not Working

Hi Folks,

Today I came across an unusual error while viewing "Administration Reports" under "Reports" section in "SharePoint 2010 Search Service Application".

I clicked on Administration Reports->"Search administration reports" folder->Clicked on the following reports

CrawlRatePerContentSource-> Resulted in error. Error description as "Could not find stored procedure 'dbo.Search_GetCrawlRatePerContentSource'".
CrawlRatePerType-> Resulted in error. Error description as "Could not find stored procedure 'dbo.Search_GetCrawlRatePerType'".
QueryLatency-> Resulted in error. Error description as "Could not find stored procedure 'dbo.Search_GetQueryLatency'".
QueryLatencyTrend -> Resulted in error. Error description as "Could not find stored procedure 'dbo.Search_GetQueryLatencyTrend'".
SharePointBackendQueryLatency -> Resulted in error. Error description as "Could not find stored Procedure 'dbo.Search_GetSharePointBackendQueryLatency'".

I traced the query in SQL Profiler. The queries are being submitted to the SQL Server against the database "WSS_UsageApplication" and went ahead to look for the stored procedures which SharePoint was referring as missing, to my surpise the stored procedures doesn't exists.

After digging around for a while, I identified there is a SharePoint Job named as "Search Health Monitoring - Trace Events" to be enabled and scheduled to get the reports and the data. Once I enabled this Job the relevant missing stored procedures are automatically created in "WSS_UsageApplication" database and reports started working :)

Scenario: Unable to view SharePoint 2010 Administration Reports for Search

Problem: Timer Job "Search Health Monitoring - Trace Events" not enabled

Resolution: Enable the timer Job "Search Health Monitoring - Trace Events"

Other relevant links: http://social.msdn.microsoft.com/Forums/is/sharepoint2010general/thread/9ff7086b-6fd1-428a-9def-229f25c4c5d5

Happy Debugging!!!