Freigeben über


Add or Modify SharePoint 2013 / 2016 Search Topology using a PowerShell built User Interface

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.

Intro
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.

Special Thanks
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. https://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 Release

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.

Testing
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

  1. 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),
  2. 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,
  3. Open the file in PowerShell ISE (Select Run as Administrator) or in a Standard SharePoint PowerShell window (Run as Administrator),
  4. 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
  5. 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.
https://gallery.technet.microsoft.com/Add-or-Modify-SharePoint-c7d83c93

Comments

  • Anonymous
    January 01, 2003
    Thank you.
  • Anonymous
    May 22, 2015
    Great work Scott
  • Anonymous
    May 22, 2015
    Very Nice Work Scott! I am going to create a link off my blog, http://blogs.technet.com/acasilla to point to this.
  • Anonymous
    June 06, 2015
    Simply Awesome needed something life this Scott,
  • Anonymous
    July 21, 2015
    The comment has been removed
  • Anonymous
    July 22, 2015
    Hi Kevin, great to hear that it helped. Working on V3 and hope to have it out soon to include replicas and partitions.
  • Anonymous
    July 30, 2015
    H Scott, great work ! I have the following error: "Path could not be created on click IMPORT to reset and try again"
    any idea ?
    • Anonymous
      April 20, 2016
      Serge, ping me via messaging and let me see what is going on. What server OS are you running and have you enabled WINRM and PSRemoting?
  • Anonymous
    July 30, 2015
    sorry, the error message was : Path could not be created on appserver1 click IMPORT to reset and try again
  • Anonymous
    August 05, 2015
    Same Error for me also for path. Does it create some logs?
  • Anonymous
    August 05, 2015
    Hi Serge and Sumeet, the Path creation is done remotely i.e. from the Server the tool is running from. It uses the Invoke-command with (mkdir path). What are you putting in as the path? I have only ever seen this happen when the account running the tool is not the farm admin and does not have admin rights on all the SharePoint servers?
  • Anonymous
    August 21, 2015
    Great tool Scott!! thanks so much!
  • Anonymous
    September 09, 2015
    Scott this script is amazing! This should be packaged with SharePoint!
  • Anonymous
    September 15, 2015
    The comment has been removed
    • Anonymous
      April 20, 2016
      Hi Simon, unfortunately yes. Index Partitions are currently not catered for as can be seen in my notes. In order to cater for index partitions I have to cater for the max which is 25 I am have been unable to get the edit screen for that working at this stage. The form to edit the partitions is just too difficult to use and cater for each partition combination. It almost becomes impossible to see what partitions are setup on which servers. It's a bit of a catch22.
  • Anonymous
    September 15, 2015
    Hi Simon, yes that is the issue. If you review the write up for this version (2_8), I have not included Partitions as yet. I have been a bit delayed getting out V3 which will include that.
    Creating partitions and replicas is a recommended practice but currently V2_8 only handles replicas on separate servers and does not cater for Partitions.
    I will hopefully get V3 out soon.
  • Anonymous
    September 16, 2015
    Hi Scott - I did see the note about partition support in V3, I suspected it was the case.
    Thanks for such a fast response, and good luck on finding some time to finish up V3!
  • Anonymous
    September 18, 2015
    The comment has been removed
  • Anonymous
    October 21, 2015
    Thank you Scott, great post. I was wondering how I can divide the SQL databases across multiple SQL servers. In this scenario, all the databases are on one SQL server. Any insight?
  • Anonymous
    October 21, 2015
    Hi LesIsMore, thanks. Are you wanting to create additional databases for crawl, or analytics do you want to store 1 of the 4 default db's on another SQL? If the latter is the case then what are you trying to achieve?
  • Anonymous
    October 28, 2015
    Hi Scott - Awesome !! - thanks for closing a "gap" in SP2013.. :)
  • Anonymous
    January 06, 2016
    I am trying to use this on a 2013 test farm (WIndows Server 2012 R2) with one app servers and 2 WFEs. It is giving me message that I need to enable remote PowerShell on all SharePoint servers. When I followed the instruction, the WFE servers told me that remote PS was already enabled. What else should I look at to get this working?TIA
    • Anonymous
      January 20, 2016
      Hi Dean, make sure you take this new version (2_8_2) and also make sure you have run "Enable-PSRemoting –force" (from an Administrator PowerShell window) and "WINRM quickconfig" (Dos command but can also be run from PowerShell) on EACH server. This is required as I use remote PowerShell to create the folders for the Index servers as well as quite a few other remote commands.
      • Anonymous
        April 06, 2016
        Hi ScottI'm also experiencing the same error Dean, I downloaded V2_8_2, imported my topology but when I try modifying my it i get the error “Enable-PSRemoting –force” (from an Administrator PowerShell window) and “WINRM quickconfig” on EACH server. Which I did all on all my servers servers using Administrator PowerShell window but this error persists, my index is located on "E:\Index"How do I get past this error?
        • Anonymous
          April 20, 2016
          Hi Kaya, what user account are you logging in with when launching the tool as the account must be a farm admin and a local admin on all the servers as you are performing administrative tasks?
  • Anonymous
    January 26, 2016
    Thank you Scott really great work , it saved lots of time and efforts for me
  • Anonymous
    March 10, 2016
    Can I use the farm account for search service account/ and search query pool account?I'm assuming the search content account is the crawl account, as I have one specifically for that.
    • Anonymous
      March 14, 2016
      Hi Mirza, It is recommended that separate accounts always be used to configure SharePoint with a least privileged configuration. If you just separated the content account then search would work as expected. Just remember that using one account for the admin pool and web app pool essentially opens up your Central Admin security and any custom solutions could actually then manipulate central admin utilizing the SPRunWithElevatedPrivileges command.
      • Anonymous
        March 17, 2016
        Scott,thanks for replying to my other comment.I have an issue when importing current topology and modifying it. I currently have index on my app server. I want to add the index to both my WFE. When adding the index and clicking "modify topology"I get an error at the bottom in red, "Path Could not Be Created on WFE1"What am I doing wrong?
        • Anonymous
          March 22, 2016
          index location is : DEFAULT
          • Anonymous
            April 20, 2016
            It sounds like you have a rights issue as the location for default will be under the Search Service account. I suggest modifying the location to a set Index location. e.g. "d:\index" dependent on what drives and disk space you have. Using the default is not recommended.
  • Anonymous
    May 03, 2016
    Really like this tool. I have run into an error with one client. The error message is Exception calling "Activate" with "0" argument(s): "Topology activation failed. Management called failed with System.InvalidOperationException: 'Unable to change topology when Generation controller is not active' at at Microsoft.Ceres.SearchCore.IndexController.IndexController.IsEmptyIndex(String indexSystemName) at Microsoft.Ceres.SearchCore.IndexController.IndexControllerManagementAgent.WrapCall[T](Func'2 original)"Can you assist with this error?
    • Anonymous
      May 04, 2016
      Hi David,Please connect with me via email using the email author link so I can see what is going on in your environment.Thanks,Scott
    • Anonymous
      June 14, 2016
      David, the Contacts link is now sorted so you can ping me there.
      • Anonymous
        August 12, 2016
        The comment has been removed
        • Anonymous
          August 18, 2016
          The comment has been removed
    • Anonymous
      February 28, 2017
      Hi I have an error when I updated the search index location Topology activation failed. Management called failed with System.InvalidOperationException: ‘Unable to change topology when Generation controller is not active’ Script version V2_8_3 Issue relating to the index path , though it was going to concatenate the server/share name not specific path. Think this was the issueAny help would be great cheers
      • Anonymous
        March 01, 2017
        Hi Aron, the share name must be valid. Concatenation will cause a variety of issues.I validate the usage of path but not concatenation and expect that the basics around folder names in windows are adhered to.
  • Anonymous
    June 07, 2016
    First of, thanks Scott for providing this. However, when I run this in our server, nothing happens. I click the import button, but the current topology is not displayed. Everything stays blank. I don't get any errors as well. Any idea what might be happening?
    • Anonymous
      June 07, 2016
      Hi Chris, have you already created a Search Service App? Which version of SP are you running this on. Ping me via the email author option and I will respond to you.
      • Anonymous
        June 13, 2016
        Hi Scott, yes, the SSA is already created. We are running SP2013.
        • Anonymous
          June 14, 2016
          Hi Chris,The contacts link is now available.Please ping me via that so I can try and assist you as I have tested this script on a large variety of SP2013 installations so I need to see what could be going wrong here.Thanks,Scott
          • Anonymous
            June 16, 2016
            Thanks Scott. I tried with the contact link, but it says spam detected. :)
            • Anonymous
              June 17, 2016
              The comment has been removed
          • Anonymous
            August 25, 2016
            We had this problem and fixed by granting adding our Setup and Farm Admin accounts to the SSA Administrators role
            • Anonymous
              August 25, 2016
              Thanks Dean. That's a strange one because if you are using a Farm Admin account then you already have this permission set so it shouldn't be necessary.
    • Anonymous
      June 08, 2016
      Hello Scott/Chris, I am having the same problem. Did you resolve the problem? Can you please share what you did to fix it?
      • Anonymous
        June 09, 2016
        Ram, please ping me on this as Chris has not responded yet and I would like to assist and solve this.
        • Anonymous
          June 12, 2016
          Scott, Not sure how to ping you, couldnt find email address anywhere. I am running into same problem as Chris. When I launch the script the UI loads and shows the service app name but doesnt show the servers or the services running. Nothing happens if I client on "Import" or "Create New Service App" either
          • Anonymous
            June 12, 2016
            Please post OS used, version of SharePoint, SQL, etc. so I can try and replicate the issue as this hasn't changed in quite a few months so it may just be a simple SP version issue that I need to resolve.I will try and sort out the contact info in the meantime as well.To confirm, you are running this on a SharePoint server, joined to a farm and you are a Farm Admin?
          • Anonymous
            June 14, 2016
            Hi Ram,The contacts link is now available.Please ping me via that.Thanks,Scott
  • Anonymous
    June 15, 2016
    Hi Scott, thanks first, we are runing SP2013 with Search Service was created,when i run this tools with click IMPORT button, it's alert that "Usage and Health Service Application Proxy is not Online", in fact , the Usage and Health Service Application Proxy was startedhow can i fix it?
    • Anonymous
      June 17, 2016
      This check is in place because of issues with starting Search when the Usage and Health Service Proxy is not available.It may just need an IISReset. Make sure that the Usage and Health Service is started under the services on server section.
  • Anonymous
    July 27, 2016
    Hi Scott, sorry was being away on project duties. I would like to help to fix this, as it still doesn't work. Let me know how to get it going.
    • Anonymous
      July 27, 2016
      Hi Chris, I would love to get to the bottom of the issue that only seems to affect certain people as I built in a lot of redundancy and "safety nets". You should be able to email me via the contact link now and send me the error details and I will then communicate with you directly. I am also looking for someone to get involved with helping me finalize V3 to include index partitions as the screen layout is an issue for me right now. It just doesn't work and makes selection of the partition too complicated so the logic is simple but the screen is complicated. Please let me know if you have a problem with the contact page?
  • Anonymous
    July 29, 2016
    Hi Scott, I am trying it with admin account(Farm admin and local admin group member) I am getting below error and I have checked all the servers PS-Remoting is already enabled (WinRM is already set up to receive requests on this computer).What else could be the reason behind this error ?Enable remote PowerShell on all SharePoint servers. Run 'Enable-PSRemoting –force' and 'WINRM quickconfig' on EACH server??
    • Anonymous
      August 18, 2016
      What OS are your servers running?
      • Anonymous
        July 24, 2017
        Hi Scott,Many Thanks for the script. I am getting the same error "Enable - PS remoting " and i have enabled on all the servers.Operating system is Windows server 2012 R2.Much appreciated for your suggestions.
        • Anonymous
          September 27, 2017
          Hi Sundar, I have seen this once or twice and then had to run Winrm quickconfig but here is a link to troubleshooting the issue https://blogs.msdn.microsoft.com/powershell/2009/04/30/enable-psremoting/
          • Anonymous
            February 18, 2018
            Hello Scott,we have the same PSremoting-issue. Everything worked fine for first test migration and suddenly we got this behaviour. In another Farm two migrations modifying topology worked properly, but at the same time in both farms topology changes don't work. We are domain admins, check GPO. Everything fine.Our environment is build on Server 2016 with SharePoint 2016. First it worked, and suddenly not? What could be the reason?Remot Powershell works in general.ThanksPeter
  • Anonymous
    August 23, 2016
    Hi Scott,You mentioned... "It sounds like you have a rights issue as the location for default will be under the Search Service account. I suggest modifying the location to a set Index location. e.g. “d:\index\” dependent on what drives and disk space you have. Using the default is not recommended."Can you explain what you mean by "location for default will be under the Search Service Account". How can I see the default location, from viewing the search service account? where?Also, how can I resolve this rights issue.Thank you for the great script! It worked wonders for me. I just need assistance with this last bit. I want my index partitions on both my application servers. If I change the index location - will I need to create these index locations on both servers prior to running this script?
    • Anonymous
      August 23, 2016
      The comment has been removed
  • Anonymous
    August 29, 2016
    The comment has been removed
    • Anonymous
      August 31, 2016
      Hi Eric, if the server is offline I don't believe you can move it as it doesn't exist. It sounds like you will need to create a new Search Service app. You can use the script to do that. If that server is showing elsewhere in your farm I suggest removing it in Central Admin as well so that no services try to connect to it.
      • Anonymous
        September 09, 2016
        The comment has been removed
        • Anonymous
          October 18, 2016
          The comment has been removed
  • Anonymous
    September 16, 2016
    Great tool and time saver. Much appreciated.
  • Anonymous
    November 25, 2016
    The comment has been removed
    • Anonymous
      December 07, 2016
      Hi Sathiya, this has nothing to do with the tool but the following basic steps should be followed to get through crawl issues:Validate permissions of the crawl account i.e. make sure it has read permission for the web application that you are pointing the crawler to.Configure the correct URL in the schedule.If you have extended the web app to an external URL and require a proxy for external access then rather use the internal URL for crawling and create a search mapping to replace the URL in the query results.The alternative would be to provide proxy details on each crawl server and that should get the same result but then you are going through the load balancer and that may not be what you are trying to achieve.It looks like you are using a robots.txt file and from the responses you have received to your questions it may be best to remove all rules and start again i.e. clear the slate, crawl and validate the results and then start applying exclusions accordingly.There is a Search blog run by Microsoft Search Experts https://blogs.technet.microsoft.com/onsearch/ and Brian Pendergrass covers a lot in his blog https://blogs.msdn.microsoft.com/sharepoint_strategery/
  • Anonymous
    December 06, 2016
    The comment has been removed
    • Anonymous
      December 07, 2016
      In this case, I would suggest that you create a new SSA. The tool is often able to repair a topology but it looks like it is unable to do so in this case.I have never had it not be able to repair a Topology except when not all servers were online and the server could not be reached.Which version of SP are you running this on and what OS is being used?
  • Anonymous
    January 31, 2017
    Very interesting subject, thank you for putting up.
  • Anonymous
    February 10, 2017
    The comment has been removed
  • Anonymous
    February 11, 2017
    The comment has been removed
    • Anonymous
      March 01, 2017
      Hi, this log unfortunately doesn't help provide much insight. What error showed when you ran this PowerShell script?Are you running this on VM's?Have you made sure that all servers time is sync'd including with the host?I have also seen anomalies on this when .Net 3.5 was not installed on all servers in the farm but this is normally the case when you are using SP2013 with SQL 2012.These are just ideas based on errors seen in the past so may not fix your issue.Thanks, Scott
  • Anonymous
    April 24, 2017
    The comment has been removed
    • Anonymous
      April 24, 2017
      The comment has been removed
      • Anonymous
        April 25, 2017
        Thanks Scott!
  • Anonymous
    May 10, 2017
    The comment has been removed
    • Anonymous
      May 24, 2017
      Hi Vishnu,You would need to provide a lot more info than that i.e. what do the ULS logs show for the error?I suggest sending me a message using the contact page and providing the info.
  • Anonymous
    May 20, 2017
    Great work Scott. Works like a charm. I would like know of the status of v.3, because I am interested in utilizing multiple partitions with SharePoint 2016
    • Anonymous
      May 24, 2017
      Hi Nee, V3 is not going to happen unfortunately as I couldn't get to a point where the UI was useable as you can have up to 25 partitions.It became too complicated to actually capture the requirements. If I had a simple way of capturing them then I could do something but I have stopped work on this for the moment.I am actually looking for someone to take over this work as I have shifted my focus to SharePoint Online.
  • Anonymous
    May 25, 2017
    I tried to run this script on Windows 2012 R2, it just shows blank for both current and new topology. No any button works, Modify Topology button is disabled
    • Anonymous
      May 25, 2017
      If you don't have an existing Search Service Application then the dropdown at the top will be disabled. If you do have one then you need to click "Import Topology". You have to import an existing topology to modify or you have to create a new Service Application if you don't have one. If everything is disabled then you will see there is a pop up message saying "No SharePoint Farm Found". This must be run on a SharePoint server and you must be the SharePoint Farm Admin.
  • Anonymous
    July 28, 2017
    The comment has been removed
    • Anonymous
      September 27, 2017
      Hi David, please make sure that database names and service application and service application pool names have never been used before. I have seen this happen when a name is re-used.
  • Anonymous
    November 02, 2017
    Well, This is what I wanted to know!
  • Anonymous
    December 26, 2018
    Hey Scott, The tool is great and a great time saver but I have one issue. Whenever I tried to run Modify Topology I get these errors: Enable remote Powershell on all SharePoint servers. Run “Enable-PSRemoting –force” and “WINRM quickconfig” on EACH server. I have run those commands on "EACH"/all servers but I still get the error. Any advice would be greatly appreciated.
  • Anonymous
    January 04, 2019
    Hi Scott, compliments for this amazing tool, but using it on customer new environment (W2016 and SP2016) I have same issue than ThangPQ3: all boxes are blank and not populated except for "Search Service Application" that is correct; all button didn't work. Consider that I'm using farm admin account. What I can check to verify if I'm forgetting something?RegardsFabioA
    • Anonymous
      January 07, 2019
      Hey Fabio, have you read my response to ThangPQ3?Have you created a service application already? If not, then you will need to do so first.Here is the response I provided ThangPQ3 - "If you don’t have an existing Search Service Application then the dropdown at the top will be disabled. If you do have one then you need to click “Import Topology”. You have to import an existing topology to modify or you have to create a new Service Application if you don’t have one. If everything is disabled then you will see there is a pop up message saying “No SharePoint Farm Found”.This must be run on a SharePoint server and you must be the SharePoint Farm Admin."Ping me via the contact link and I will respond to your email so you can send me screenshots if you are still stuck.