Wednesday, 1 July 2015

SharePoint 2010: Create new Search Services with Custom DB names Powershell

When you try to create Search services in SharePoint 2010 using the wizard, it gives you nightmare with the Database names with horrible GUIDs...

here is a simple script to ease your life:

## Parameters used

## change the variables below to your own servers and naming conventions



$databaseServerName = "shrpt-db-server"

$searchServerName = "shrpt-apps-server"

$searchSAName = "Search Service Application"

$saAppPoolName = "SharePoint Web Services Default"

$searchDBName = "Search_Services_Application_DB"



## First remove the old search

## This will require an id - namely a guid so get the service guid before doing this



$spapp = Get-SPServiceApplication -Name $searchSAName

Remove-SPServiceApplication $spapp -RemoveData



##START SEARCH

Write-Host "Creating Search Service and Proxy..."

Write-Host "  Starting Services..."

Start-SPEnterpriseSearchServiceInstance $searchServerName

Start-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance $searchServerName



Write-Host "  Creating Search Application..."

$searchApp = New-SPEnterpriseSearchServiceApplication -Name $searchSAName -ApplicationPool $saAppPoolName -DatabaseServer $databaseServerName -DatabaseName $searchDBName

$searchInstance = Get-SPEnterpriseSearchServiceInstance $searchServerName



Write-Host "  Creating Administration Component..."

$searchApp | Get-SPEnterpriseSearchAdministrationComponent | Set-SPEnterpriseSearchAdministrationComponent -SearchServiceInstance $searchInstance



##Crawl



Write-Host "  Creating Crawl Component..."

$InitialCrawlTopology = $searchApp | Get-SPEnterpriseSearchCrawlTopology -Active

$CrawlTopology = $searchApp | New-SPEnterpriseSearchCrawlTopology

$CrawlDatabase = ([array]($searchApp | Get-SPEnterpriseSearchCrawlDatabase))[0]

$CrawlComponent = New-SPEnterpriseSearchCrawlComponent -CrawlTopology $CrawlTopology -CrawlDatabase $CrawlDatabase -SearchServiceInstance $searchInstance

$CrawlTopology | Set-SPEnterpriseSearchCrawlTopology -Active



Write-Host -ForegroundColor white "  Waiting for the old crawl topology to become inactive" -NoNewline

do {write-host -NoNewline .;Start-Sleep 6;} while ($InitialCrawlTopology.State -ne "Inactive")

$InitialCrawlTopology | Remove-SPEnterpriseSearchCrawlTopology -Confirm:$false

Write-Host  



##Query



Write-Host "  Creating Query Component..."

$InitialQueryTopology = $searchApp | Get-SPEnterpriseSearchQueryTopology -Active

$QueryTopology = $searchApp | New-SPEnterpriseSearchQueryTopology -Partitions 1

$IndexPartition= (Get-SPEnterpriseSearchIndexPartition -QueryTopology $QueryTopology)

$QueryComponent = New-SPEnterpriseSearchQuerycomponent -QueryTopology $QueryTopology -IndexPartition $IndexPartition -SearchServiceInstance $searchInstance

$PropertyDatabase = ([array]($searchApp | Get-SPEnterpriseSearchPropertyDatabase))[0]

$IndexPartition | Set-SPEnterpriseSearchIndexPartition -PropertyDatabase $PropertyDatabase

$QueryTopology | Set-SPEnterpriseSearchQueryTopology -Active

## Proxy



Write-Host "  Creating Proxy..."

$searchAppProxy = New-SPEnterpriseSearchServiceApplicationProxy -Name "$searchSAName Proxy" -SearchApplication $searchSAName > $null



#####END SEARCH   

Wednesday, 3 June 2015

There was a problem retrieving data for this field. Updating values in this field is disabled temporarily. You can still update values in other fields.

While trying to update user profile of a user in SharePoint 2010 I got this error  "There was a problem retrieving data for this field. Updating values in this field is disabled temporarily. You can still update values in other fields.".





The SharePoint farm was using cross-farm services. The "Managed Metadata Web Service" was shared between the farms. This issue can be resolved by enabling "This service application is the default storage location for Keywords." option for the "Managed Metadata Web Service Proxy".



Wednesday, 6 May 2015

SharePoint Excel Serivces Error

So if you have seen this error:

Excel Services:
We're sorry. We ran into a problem completing your request. Please try that again in a few minutes.


Believe me even if you tried again in few minutes it might not work...

Few suggestions:
Check in central admin if your excel services is running.
Check if you have an Excel Service application in your service applications.

In Central Administration



Go to Application Management



And then in Manage Web Application



I select my web site (Share Point - 80) and then select 'Service Connection'



Finally I Checked Excel Service Application And it work for me.




Wednesday, 15 April 2015

SharePoint 2010: Remove the My Site Host Location URL





So if you have seen the above screen and wondering if it is ever possible to remove my site host location follow simple power-shell to remove it.

$site = Get-SPSite "http://<url of your admin site>"

$context = Get-SPServiceContext($site)

$upm = New-Object -TypeName Microsoft.Office.Server.UserProfiles.UserProfileManager -ArgumentList $context

$upm.MySiteHostURL="";

Tuesday, 3 March 2015

Sharepoint 2010 error opening .pdf files




When you try to open a PDF document from your standard SharePoint library, as it tries to open it in Acrobat viewer and you encounter the error:

There was an error opening this document. The filename, directory name, or volume label syntax is incorrect.

You can fix it read below:

DON'T


  • Change Client Integration
  • Change File handling methods

DO

Go to the following Path:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\XML

Edit the DOCICON.XML file 

Find this entry

<Mapping Key="pdf" Value="icpdf.png" OpenControl="PdfFile.OpenDocuments"/>




and edit it to 

<Mapping Key="pdf" Value="icpdf.png" OpenControl="SharePoint.OpenDocuments"/>





Hope this fixes your problem


Tuesday, 3 February 2015

Using the Developer Dashboard

How to Enable the Developer Dashboard

The Developer Dashboard is always off by default. To make it viewable, you must enable it, by using STSADM, Windows PowerShell cmdlets, or the SharePoint Foundation object model.

Using STSADM
Open a command window to the %ProgramFiles%\Common Files\Microsoft Shared Debug\Web Server Extensions\14\BIN directory and enter one of the following commands, depending on the desired display mode.

Mode (Always On)
stsadm -o setproperty -pn developer-dashboard -pv on

OnDemand
stsadm -o setproperty -pn developer-dashboard -pv ondemand


Using Windows PowerShell Cmdlets
Mode (Always On)
(Get-SPFarm).PerformanceMonitor.DeveloperDashboardLevel = ”On”

OnDemand
(Get-SPFarm).PerformanceMonitor.DeveloperDashboardLevel = ”OnDemand”


How to Disable the Developer Dashboard

Using STSADM
stsadm -o setproperty -pn developer-dashboard -pv off


Thursday, 8 January 2015

SharePoint 2010: Site Web Analytics Reports Issue/Error

ISSUE:

You are trying to access “Site Web Analytics Reports” on your site using the below URL

http://<Your_Site_URL>/_layouts/UsageDetails.aspx

But everytime, you try to access the report, you are getting error message, which is mentioned below:

Unexpected failure.

 Troubleshooting Microsoft SharePoint Foundation.

 Correlation ID: 1e9c-4f07-0eb920fa-9311-b353aa6eac13

 Date and Time: 08/15/2012 13:08:05 


RESEARCH:

I checked and found that we can access the report by directly accessing the URL mentioned below
http://<Your_site_URL>/_layouts/WebAnalytics/Report.aspx?t=SummaryReport&l=s

When i browse the above url, i get below message:

This report displays all available metrics Web Analytics for the specified date range, and the tendency to change the date range above. This requires that the new SharePoint user experience is on. A site owner or administrator can enable the new experience from the Site Actions menu option or from the title, description and appearance of Site Settings.

RESOLUTION:

This is the new feature made available in SharePoint 2010, hence the Visual upgrade of site is a must to work this. Which means the current look n feel of 2007 need to be upgrade to 2010. Once this is performed the site display will change many things and remove any kind of custom work on the site.