Welcome to the SharePoint Search Topology Add / Modification Sample tool
PLEASE NOTE THAT THIS CODE IS PROVIDED AS SAMPLE CODE TO MODIFY THE SEARCH TOPOLOGY.
Please read the disclaimer in the PowerShell source code.
Updated to V2_8_3 to accommodate updates from Nov 2016 (MinRole changes) and includes the Cloud SSA flag option.
If you choose to create a Cloud Search Service Application (Cloud SSA) then you will need to review the guidance https://blogs.msdn.microsoft.com/spses/2015/09/15/cloud-hybrid-search-service-application/
This script has the option (unchecked by default) to allow you to create a Cloud SSA but it is not the primary purpose of the script.
From SharePoint 2013 onwards there is no User Interface to modify the Search topology and you are only able to create it either via PowerShell or via the UI where you are able to create a Search Service Application on a single server in the farm.
Any modifications to the Topology will require a fairly decent knowledge of the Search Topology as well as PowerShell.
To help with this I decided to write a PowerShell script that utilizes Windows Forms and provides you a UI to view, add and modify the topology.
The code can be safely run as no changes are executed until you instruct the code to do so and you will be prompted to confirm again before it starts.
Simply scroll to the end of the blog and download via the link from the TechNet Gallery.
To get this version out a few thanks need to go out to Koos Botha (Helping me with some of the Forms Code in PowerShell) and Neil Hodgkinson (His endless sharing of knowledge on Search).
There are also 2 extracts from Joe Rodgers that are highlighted in the code. http://blogs.msdn.com/b/josrod/
Thanks to Brian Pendergrass for his input on understanding how components flow as well as storage locations.
There were a few other inputs as well, particularly when I was looking for the “.Name” property (Paul) of one of the PowerShell commands and they know who they are.
This script does not support multiple index partitions but does allow multiple Index servers (Replicas), Index moves i.e. location changes and changing of Index servers.
This release (V2_8_3):
- KB for Admin Issue included,
- SP2016 supported for TAP Customers and min role changes,
- Index location bug fix with multiple index servers and where ‘CreatorOwner’ permissions have been explicitly removed for server lockdown and hardening,
- Search Service Applications can be created,
- Broken Search Topologies can often be repaired (Simply select a Broken Search Service Application and choose alternate servers for the broken Components),
- It Reads in the existing the Search Service Application Topology (There is no Server number limit in this code but remember a single Search Service application is limited to https://technet.microsoft.com/en-us/library/cc262787.aspx#Search),
- It Displays and allows Moving any components to any servers in the farm (Servers will be automatically shown and made available to the Search if they exist in the Farm).
- Support to handle multiple Search Service Applications,
- Support for moving the Index location including deleting the previous location if not the default. It also creates the new location for you on all servers in the farm (Remote PowerShell to be enabled but it checks for that too).
NB – Make sure all servers are Online – if a server in the farm is off or not available it will still allow it to be added to the Topology (it will be marked with a red cross) and it will come online as soon as the server is available again.
As usual please test this out in your Dev and Test environments and of course no liability can be accepted for any issues experienced or possibly caused by running the code.
How to Use it
- Log on to the SharePoint Server as a Farm Administrator (Local Admin is required on all SharePoint Servers as well by SharePoint when a User is added as the Farm Admin),
- Scroll to the bottom of the article, Click on the link to download and Save the file AddModifySearchTopologyV2_8_3.ps1 to one of your SharePoint Servers,
- Open the file in PowerShell ISE (Select Run as Administrator) or in a Standard SharePoint PowerShell window (Run as Administrator),
- If you opened it in PowerShell ISE then simply click run otherwise if you opened it in the SharePoint PowerShell window simply navigate to where you saved it and run .\AddModifySearchTopologyV2_8_3.ps1
- Follow the on screen messages i.e. Import, Create Now and Modify using the CheckBoxes and when ready click Create Now or Modify Topology to start
(Remember this can take a long time to Run as the new Topology is being activated – A message will display to show when it’s compete.)
How does it Work?
It exports the current Topology to an XML file, reads in the details and displays your current topology in the Top List boxes.
It then automatically selects your Current Topology in the New Topology section below to make editing easier.
Simply click on the server names in the different component sections to make changes.
Once complete click Create Now or Modify Topology to start the process.
The code first clones the Topology, then deletes any Components you have removed and then adds any new Components to the Cloned Topology. It then Sets the new Topology as the Active Topology and removes the old, now inactive Topology.
There are some conditions in topology modification for SharePoint and some require a 2 step process i.e. Changing all Index Components.
One careful item to note is that SharePoint Search Index Component cannot just be replaced in 1 modification i.e. once it is created at least 1 Index Component must remain so basically if “Server A” is hosting the Index and you would like to move it to “Server B” then you have to add “Server B” to the Index first and apply the changes. This version now does the multi-modification for you.
Donwload the file directly from the TechNet Gallery.