March 9, 2017

Add/Move SharePoint 2013 farm Search Topology in Single or Multiple Search Servers using PowerShell

SharePoint 2013 farm provides Search Topology that comprises Admin, Crawler, Content Processing, Analytics Processing, Query Processing and Index Partition.

  • Search Administration Component administers new instances of Search components and Search processes.
  • Search Crawler enables us to crawl all the content in our site thereby allowing us to retrieve results via SharePoint Search. 
  • Search Content Processing allows us to process different types of contents and indexing them in a single index.
  • Search Analytics Processing component of Search topology deals with analytics related stuffs. It carries out search analytics and usage analytics.
  • Search Query Processing component handles incoming queries and returns suitable results.

Scenario 1: If you want to move SharePoint 2013 farm Search Topology from one server (e.g. Server1) to another (e.g. Server2), then follow below mentioned steps:

Prerequisites:
 - Search service application must be created and configured in the farm.
 - Search Topology must have been configured in Server1.
 - Server2 must be part of  SharePoint 2013 farm.
 - Ensure that no search crawl is running and search index is empty.

Connect to any of your SharePoint 2013 farm server and run SharePoint Management Shell as an Administrator. 

Run below given commands in SharePoint Management Shell one by one :

$hostA = Get-SPEnterpriseSearchServiceInstance -Identity "Server2"
# Note: "Server2" is new server name, where we want to move Search Topology.

Start-SPEnterpriseSearchServiceInstance -Identity $hostA
Get-SPEnterpriseSearchServiceInstance -Identity $hostA
$ssa = Get-SPEnterpriseSearchServiceApplication
$newTopology = New-SPEnterpriseSearchTopology -SearchApplication $ssa
New-SPEnterpriseSearchAdminComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchCrawlComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchContentProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchAnalyticsProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchIndexComponent -SearchTopology $newTopology -SearchServiceInstance $hostA -IndexPartition 0
Set-SPEnterpriseSearchTopology -Identity $newTopology
Get-SPEnterpriseSearchTopology -SearchApplication $ssa
Get-SPEnterpriseSearchStatus -SearchApplication $ssa -Text

Finally, Search Topology will be migrated from "Server1" to "Server2", and you will be able to see Search Topology components in "Server2".

*After moving Search Topology to new server, start full crawl to get search results.

Scenario 2: If you want to add an additional search server (e.g. Server2),  along with existing search server -- Server1, then follow below mentioned steps:

Prerequisites:
 - Search service application must be created and configured in the farm.
 - Search topology must have been configured in Server1.
 - Server2 must be part of  SharePoint 2013 farm.
 - Ensure that no search crawl is running and search index is empty.

Connect to any server of SharePoint 2013 farm and run SharePoint Management Shell as an Administrator. 
Run below given commands in management shell one by one :

$hostA = Get-SPEnterpriseSearchServiceInstance -Identity "Server2"
# Note: "Server2" is new server name, which we are going to add.

Start-SPEnterpriseSearchServiceInstance -Identity $hostA
Get-SPEnterpriseSearchServiceInstance -Identity $hostA
$ssa = Get-SPEnterpriseSearchServiceApplication
$newTopology = New-SPEnterpriseSearchTopology -SearchApplication $ssa
New-SPEnterpriseSearchAdminComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchCrawlComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchContentProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchAnalyticsProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchIndexComponent -SearchTopology $newTopology -SearchServiceInstance $hostA -IndexPartition 1
# Note: For Adding second Search Server Topology, we must have to give -IndexPartition as 1. Because, "Server1" would already have 0 as IndexPartition.

Set-SPEnterpriseSearchTopology -Identity $newTopology
Get-SPEnterpriseSearchTopology -SearchApplication $ssa
Get-SPEnterpriseSearchStatus -SearchApplication $ssa -Text

Finally, You will be able to see newly added search servers in SharePoint 2013 farm.

*After adding an additional search server in SharePoint 2013, start full crawl to get search results.

Scenario 3: If you want to add multiple search servers (e.g. Server1 and Server2) at a time, then follow below mentioned steps:

Prerequisites:
 - Search service application must be created and configured in the farm.
 - Server1 and Server2 must be part of  SharePoint 2013 farm.
 - Ensure that no search crawl is running and search index is empty.

Connect to any server of SharePoint 2013 farm and run SharePoint Management Shell as an Administrator. 

Run below given commands in management shell one by one :

$hostA = Get-SPEnterpriseSearchServiceInstance -Identity "Server1"
$hostB = Get-SPEnterpriseSearchServiceInstance -Identity "Server2"
# Note: "Server1" and "Server2" are new servers, which we are going to add.

Start-SPEnterpriseSearchServiceInstance -Identity $hostA
Start-SPEnterpriseSearchServiceInstance -Identity $hostB
Get-SPEnterpriseSearchServiceInstance -Identity $hostA
Get-SPEnterpriseSearchServiceInstance -Identity $hostB
$ssa = Get-SPEnterpriseSearchServiceApplication
$newTopology = New-SPEnterpriseSearchTopology -SearchApplication $ssa
New-SPEnterpriseSearchAdminComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchCrawlComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchContentProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchAnalyticsProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchIndexComponent -SearchTopology $newTopology -SearchServiceInstance $hostA -IndexPartition 0

New-SPEnterpriseSearchAdminComponent -SearchTopology $newTopology -SearchServiceInstance $hostB
New-SPEnterpriseSearchCrawlComponent -SearchTopology $newTopology -SearchServiceInstance $hostB
New-SPEnterpriseSearchContentProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostB
New-SPEnterpriseSearchAnalyticsProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostB
New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostB
New-SPEnterpriseSearchIndexComponent -SearchTopology $newTopology -SearchServiceInstance $hostB -IndexPartition 1
# Note: For adding an additional search server in farm, we must give -IndexPartition 1

Set-SPEnterpriseSearchTopology -Identity $newTopology
Get-SPEnterpriseSearchTopology -SearchApplication $ssa

Get-SPEnterpriseSearchStatus -SearchApplication $ssa -Text

Finally, You will be able to see newly added search servers in SharePoint 2013 farm.

*After adding an additional search server in SharePoint 2013, start full crawl to get search results.

If you have any questions you can reach out our SharePoint Consulting team here.

Users with Full Control permission are not able to create sub-site in SharePoint

Problem Statement:
I spent lot of time to fix a strange issue while working with SharePoint 2013 project. Issue was a user having Full Control permission in SharePoint Top level site was not able to create a sub-site. Each time user tried to create either a "Project Site" or "Team Site" user got “Sorry, you don’t have access to this page” or “Access Denied” error. This was the identical behavior for all the users having Full Control permission.

Problem Symptoms:
      1. It appeared SharePoint was ignoring the Full Control access permission.
      2. User with site collection administrator permissions could create sub-sites.
      3. New site collections on the same web application operated normally without this issue.

Root Cause:
     1. Internally, SharePoint manages a hidden list named "TaxonomyHiddenList". URL of the list is -  "[sitecollectionURL]/lists/taxonomyhiddenlist".
     2. Generally, All authenticated users (everyone) has Read access to this list.
     3. As a site collection administrator user, when I checked permissions of the list, I found none of user or group were having permissions to this list as you can see in below screenshot.


Resolution: The solution was simple once identified. We should assign read access to all authenticated users (Everyone) operating within the site collection.

I had spent more time to fix the issue as it was a difficult one to identify, Hope this helps you out to overcome it more efficiently.

If you have any questions you can reach out our SharePoint Consulting team here.

March 7, 2017

Use Session Storage Object over Local Storage in JavaScript

In few instances, we might come across such requirement where we have to retain/store variable values specific to browser tab over successive post back. Normally, If we open same HTML page in multiple tabs in same browser, then variable value retained over successive post back would be same across all opened tabs. But if requirement is to have different variable values for each opened tab then how would we handle? Lets go through it:

Resolution: As we know, there are two options available in JavaScript to retain values over successive post back.

1. Local Storage
2. Session Storage

We can use Local Storage for saving data in browser over successive post back but there are certain limitations. It will save data in browser but data will remain same for all tabs in browser. In such scenario, where we need separate values for each browser tab, we have to use Session Storage object in JavaScript.

Local Storage:

It can store data locally within the user's browser.

Storage limit is far larger (at least 5 MB) and information is never transferred to the server.

Local storage is per origin (per domain and protocol). All pages, from one origin, can store and access the same data.

Syntax & Examples for Local Storage:

How to store the value to Local Storage in JavaScript?

Syntax: localStorage.setItem("VariableName", "Value");
Example: localStorage.setItem("BR", "Binary Replublik");

How to retrieve value from Local Storage variable in JavaScript?

Syntax: localStorage.getItem("VariableName") // Returns Object.
Example: document.getElementById("BRTeam").innerHTML = localStorage.getItem("BR");

How to remove Local Storage variable?

Syntax: localStorage.removeItem("VariableName");
Example: localStorage.removeItem("BR");

Session Storage

The Session Storage object is equal to the Local Storage object, except that it stores the data for only one session. So, the value retained with Session Storage is browser tab specific.

The data will be deleted when the user closes the specific browser tab.

Syntax & Examples for Session Storage:

How to store the value to Session Storage in JavaScript?

Syntax: sessionStorage.setItem("VariableName", "Value");
Example: sessionStorage.setItem("BR", "Binary Replublik");

How to retrieve value from Session Storage variable in JavaScript?

Syntax: sessionStorage.getItem("VariableName") //Returns Object.
Example: document.getElementById("BRTeam").innerHTML = sessionStorage.getItem("BR");

How to remove Session Storage variable?

Syntax: sessionStorage.removeItem("VariableName");
Example: sessionStorage.removeItem("BR");

Conclusion: To store variable value specific to browser tab, we have to deal with session storage over local storage.

If you have any questions you can reach out our SharePoint Consulting team here.