Migrating a Search Service Application

If you ever have to migrate a search service application from one farm to the next.  Do two things:

 

  1. Make sure that the farm’s use the correct SQL client Alias (cliconfg.exe)
  2. Run this powershell after you have migrated the SQL database and attached it within SQL.  The database named Search, or Search Admin.  In otherwords, the search admin database needs to be backed up and restored onto the target farm SharePoint SQL instance, that is the db name parameter that must match.  In the example code below we have Prod_Search as the db name. You’ll need to modify that name to match your DB name in SQL.
It will try to create a new service application named SharePoint Search Services.  So, if that application pool exists, you’ll want to delete it before running the above script, or change the name of the new service application pool.