#SharePoint 2013 – Create a Search Service Application and Search Topology with Powershell

23 Jul 2012
July 23, 2012

Writing SharePoint 2013 feels very new to me, but I created my first Demo environment and tried to set up search.

What needs to be done?

14 steps for a simple Search Topology – 1 powershell can do them all.

  1. Create a Service Application Pool for the Search Service Application (15-22)
  2. Create a Search Service Application (22-28)
  3. Create a Search Service Application Proxy (30-36)
  4. Get the current Search Instance (38)
  5. Save the current Search Topology for later use (39)
  6. Create a new Search Topology (40)
  7. Create all the Search Components (Analytics- , Content Processing, Query Processing, Crawler-, Admin Component) (42-46)
  8. Remove the Index-Folder and recreate it (50-51)
  9. Create a new Index Component (53)
  10. Activate the new Topology (56)
  11. Call the method synchronize on the old topology – this errors but forces an update on the old topology object (59)
  12. The “forced updated” Topology object becomes inactive and can be deleted. (62)
  13. Everything  done – start a full crawl oder set it to the new shiny continuous crawling. Enjoy!

The numbers in the braces are the line numbers in the powershell script following now.

 

Powershell to the rescue!

Here is my powershell script for creating the whole service application and creating a basic topology.

Please keep in mind that the $IndexLocation folder will be deleted and recreated.

Adjust the settings in the lines 4-11 to your needs.

The whole script took about 3 minutes on my machine.

image

ULSViewer showed me what timer job needs to be started

 

The result

References

I took some parts from here, but received some errors, some paramaters were missing so I adjusted the script for my needs.

The MSDN documentation is missing that there is a timer job responsible for topology changes – ULSViewer helped me to figure that one out.

Update 1, 24.07.2012 17:11

I exchanged some emails with Alpesh Nakar (funnily he created a script for the same thing) and he helped me reducing my script a lot. Thanks for that.

 

Did it work for you?

Max Melcher
Follow me!

Max Melcher

Maximilian Melcher (MCSE, MCPD) is a Principal Consultant working at Alegri International Services in Munich, Germany. Max is a specialist in SharePoint technologies focused on search, social computing, web content management and collaboration. Max has led SharePoint implementations for Dax 30 companies since 2009.
Max’s free time is spent on twitter (@maxmelcher) mostly with a good coffee in his hands.
Max Melcher
Follow me!
Tags: , ,
90 replies
  1. Dirk says:

    Just found this article after a lot of other articles. Also failed with technet ones.
    This one now works for me and is really an awesome work !
    Thanks !

    Reply
  2. Parag says:

    i want to get current name search service application so that i will check using powershell if search service is already configured it will not create it.

    Reply
  3. Mak says:

    Hello Max,
    When I run the script I got the following Error:
    The only thing I changed is that I am creating the Index on the D: drive in place of the C: drive.

    Thnx in advance for your reaction.

    Mak

    Checking if Search Application Pool exists
    Checking if Search Service Application exists
    Creating Search Service Application
    New-SPEnterpriseSearchServiceApplication : Value cannot be null.
    Parameter name: indexLocation
    At D:\Data\Search.ps1:27 char:27
    + $ServiceApplication = New-SPEnterpriseSearchServiceApplication -Name $Search ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidData: (Microsoft.Offic...viceApplication:NewSearchServiceApplication) [New-SPEnte
    rpriseSearchServiceApplication], ArgumentNullException
    + FullyQualifiedErrorId : Microsoft.Office.Server.Search.Cmdlet.NewSearchServiceApplication

    Checking if Search Service Application Proxy exists
    Creating Search Service Application Proxy

    DisplayName TypeName Id
    ----------- -------- --
    Search SA Proxy Search Service Ap... 27326019-5893-4f1c-bc17-523211a33c5b
    New-SPEnterpriseSearchAnalyticsProcessingComponent : Cannot bind argument to parameter 'SearchTopology' because it is
    null.
    At D:\Data\Search.ps1:42 char:68
    + New-SPEnterpriseSearchAnalyticsProcessingComponent -SearchTopology $SearchTopolo ...
    + ~~~~~~~~~~~~~
    + CategoryInfo : InvalidData: (:) [New-SPEnterpris...essingComponent], ParameterBindingValidationExceptio
    n
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.Office.Server.Search.Cmdlet.New
    AnalyticsProcessingComponent

    New-SPEnterpriseSearchContentProcessingComponent : Cannot bind argument to parameter 'SearchTopology' because it is
    null.
    At D:\Data\Search.ps1:43 char:66
    + New-SPEnterpriseSearchContentProcessingComponent -SearchTopology $SearchTopology ...
    + ~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidData: (:) [New-SPEnterpris...essingComponent], ParameterBindingValidationExceptio
    n
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.Office.Server.Search.Cmdlet.New
    SearchContentProcessingComponent

    New-SPEnterpriseSearchQueryProcessingComponent : Cannot bind argument to parameter 'SearchTopology' because it is null.
    At D:\Data\Search.ps1:44 char:64
    + New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $SearchTopology - ...
    + ~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidData: (:) [New-SPEnterpris...essingComponent], ParameterBindingValidationExceptio
    n
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.Office.Server.Search.Cmdlet.New
    SearchQueryProcessingComponent

    New-SPEnterpriseSearchCrawlComponent : Cannot bind argument to parameter 'SearchTopology' because it is null.
    At D:\Data\Search.ps1:45 char:54
    + New-SPEnterpriseSearchCrawlComponent -SearchTopology $SearchTopology -SearchServ ...
    + ~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidData: (:) [New-SPEnterpriseSearchCrawlComponent], ParameterBindingValidationExcep
    tion
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.Office.Server.Search.Cmdlet.New
    SearchCrawlComponent

    New-SPEnterpriseSearchAdminComponent : Cannot bind argument to parameter 'SearchTopology' because it is null.
    At D:\Data\Search.ps1:46 char:54
    + New-SPEnterpriseSearchAdminComponent -SearchTopology $SearchTopology -SearchServ ...
    + ~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidData: (:) [New-SPEnterpriseSearchAdminComponent], ParameterBindingValidationExcep
    tion
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.Office.Server.Search.Cmdlet.New
    SearchAdminComponent

    PSPath : Microsoft.PowerShell.Core\FileSystem::D:\Search
    PSParentPath : Microsoft.PowerShell.Core\FileSystem::D:\
    PSChildName : Search
    PSDrive : D
    PSProvider : Microsoft.PowerShell.Core\FileSystem
    PSIsContainer : True
    Name : Search
    Parent :
    Exists : True
    Root : D:\
    FullName : D:\Search
    Extension :
    CreationTime : 3/6/2013 1:29:38 AM
    CreationTimeUtc : 3/6/2013 9:29:38 AM
    LastAccessTime : 3/6/2013 1:29:38 AM
    LastAccessTimeUtc : 3/6/2013 9:29:38 AM
    LastWriteTime : 3/6/2013 1:29:38 AM
    LastWriteTimeUtc : 3/6/2013 9:29:38 AM
    Attributes : Directory
    BaseName : Search
    Mode : d----

    New-SPEnterpriseSearchIndexComponent : Cannot bind argument to parameter 'SearchTopology' because it is null.
    At D:\Data\Search.ps1:53 char:54
    + New-SPEnterpriseSearchIndexComponent -SearchTopology $SearchTopology -SearchServ ...
    + ~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidData: (:) [New-SPEnterpriseSearchIndexComponent], ParameterBindingValidationExcep
    tion
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.Office.Server.Search.Cmdlet.New
    SearchIndexComponent

    Activating new topology
    You cannot call a method on a null-valued expression.
    At D:\Data\Search.ps1:56 char:1
    + $SearchTopology.Activate()
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    Next call will provoke an error but after that the old topology can be deleted - just ignore it!
    You cannot call a method on a null-valued expression.
    At D:\Data\Search.ps1:59 char:1
    + $InitialSearchTopology.Synchronize()
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    Deleting old topology
    Remove-SPEnterpriseSearchTopology : Cannot bind argument to parameter 'Identity' because it is null.
    At D:\Data\Search.ps1:62 char:45
    + Remove-SPEnterpriseSearchTopology -Identity $InitialSearchTopology -Confirm:$fal ...
    + ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidData: (:) [Remove-SPEnterpriseSearchTopology], ParameterBindingValidationExceptio
    n
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.Office.Server.Search.Cmdlet.Rem
    oveSearchTopology

    Old topology deleted
    Done - start a full crawl and you are good to go (search).

    Reply
  4. Levente Rög says:

    The script didn’t work for me. The SharePoint Server Search in Services remained stopped and couldn’t start. After this I used the UI to create the service app it worked flawlessly. too bad, there is no possibility to specify the name of the DBs. Central Admin is inconsistent…

    Reply
    • Max Melcher says:

      Hi Levente,

      sorry to hear that.
      Try deleting the search service and reuse the script – then it should work.

      I guess the search service instance was not running and thats causing troubles, I should update the script to check that.

      So long,
      Max

      Reply
  5. Tom says:

    I am getting this error, I even tried to delete the SA Search and run it again, what am I missing?

    Checking if Search Application Pool exists
    Checking if Search Service Application exists
    Checking if Search Service Application Proxy exists
    New-SPEnterpriseSearchAnalyticsProcessingComponent : The search service instance on this server
    is not online
    At C:\Users\sp_install\Documents\CreateSearch Server.ps1:42 char:1
    + New-SPEnterpriseSearchAnalyticsProcessingComponent -SearchTopology $SearchTopolo …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidData: (Microsoft.Offic…essingComponent:NewAnalyticsProcess
    ingComponent) [New-SPEnterpris…essingComponent], InvalidOperationException
    + FullyQualifiedErrorId : Microsoft.Office.Server.Search.Cmdlet.NewAnalyticsProcessingCompone
    nt

    New-SPEnterpriseSearchContentProcessingComponent : The search service instance on this server is
    not online
    At C:\Users\sp_install\Documents\CreateSearch Server.ps1:43 char:1
    + New-SPEnterpriseSearchContentProcessingComponent -SearchTopology $SearchTopology …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidData: (Microsoft.Offic…essingComponent:NewSearchContentPro
    cessingComponent) [New-SPEnterpris…essingComponent], InvalidOperationException
    + FullyQualifiedErrorId : Microsoft.Office.Server.Search.Cmdlet.NewSearchContentProcessingCom
    ponent

    New-SPEnterpriseSearchQueryProcessingComponent : The search service instance on this server is
    not online
    At C:\Users\sp_install\Documents\CreateSearch Server.ps1:44 char:1
    + New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $SearchTopology – …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidData: (Microsoft.Offic…essingComponent:NewSearchQueryProce
    ssingComponent) [New-SPEnterpris…essingComponent], InvalidOperationException
    + FullyQualifiedErrorId : Microsoft.Office.Server.Search.Cmdlet.NewSearchQueryProcessingCompo
    nent

    New-SPEnterpriseSearchCrawlComponent : The search service instance on this server is not online
    At C:\Users\sp_install\Documents\CreateSearch Server.ps1:45 char:1
    + New-SPEnterpriseSearchCrawlComponent -SearchTopology $SearchTopology -SearchServ …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidData: (Microsoft.Offic…hCrawlComponent:NewSearchCrawlCompo
    nent) [New-SPEnterpriseSearchCrawlComponent], InvalidOperationException
    + FullyQualifiedErrorId : Microsoft.Office.Server.Search.Cmdlet.NewSearchCrawlComponent

    New-SPEnterpriseSearchAdminComponent : The search service instance on this server is not online
    At C:\Users\sp_install\Documents\CreateSearch Server.ps1:46 char:1
    + New-SPEnterpriseSearchAdminComponent -SearchTopology $SearchTopology -SearchServ …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidData: (Microsoft.Offic…hAdminComponent:NewSearchAdminCompo
    nent) [New-SPEnterpriseSearchAdminComponent], InvalidOperationException
    + FullyQualifiedErrorId : Microsoft.Office.Server.Search.Cmdlet.NewSearchAdminComponent

    set-SPEnterpriseSearchAdministrationComponent : The search service instance on this server is not
    online
    At C:\Users\sp_install\Documents\CreateSearch Server.ps1:48 char:1
    + set-SPEnterpriseSearchAdministrationComponent -SearchApplication $ServiceApplica …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidData: (Microsoft.Offic…rationComponent:SetSearchAdministra
    tionComponent) [Set-SPEnterpris…rationComponent], InvalidOperationException
    + FullyQualifiedErrorId : Microsoft.Office.Server.Search.Cmdlet.SetSearchAdministrationCompon
    ent

    Directory: E:\

    Mode LastWriteTime Length Name
    —- ————- —— —-
    d—- 3/28/2013 3:41 PM Search
    New-SPEnterpriseSearchIndexComponent : The search service instance on this server is not online
    At C:\Users\sp_install\Documents\CreateSearch Server.ps1:53 char:1
    + New-SPEnterpriseSearchIndexComponent -SearchTopology $SearchTopology -SearchServ …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidData: (Microsoft.Offic…hIndexComponent:NewSearchIndexCompo
    nent) [New-SPEnterpriseSearchIndexComponent], InvalidOperationException
    + FullyQualifiedErrorId : Microsoft.Office.Server.Search.Cmdlet.NewSearchIndexComponent

    Activating new topology
    Exception calling “Activate” with “0” argument(s): “The search service is not able to connect to
    the machine that hosts the administration component. Verify that the administration component
    ‘768dba65-85d1-4632-a9a6-86327aae9dbb’ in search application ‘Search SA’ is in a good state and
    try again.”
    At C:\Users\sp_install\Documents\CreateSearch Server.ps1:56 char:1
    + $SearchTopology.Activate()
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : InvalidOperationException

    Next call will provoke an error but after that the old topology can be deleted – just ignore it!
    Deleting old topology
    Remove-SPEnterpriseSearchTopology : Cannot make changes to topology in : Active state
    At C:\Users\sp_install\Documents\CreateSearch Server.ps1:62 char:1
    + Remove-SPEnterpriseSearchTopology -Identity $InitialSearchTopology -Confirm:$fal …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidData: (Microsoft.Offic…eSearchTopology:RemoveSearchTopolog
    y) [Remove-SPEnterpriseSearchTopology], InvalidTopologyException
    + FullyQualifiedErrorId : Microsoft.Office.Server.Search.Cmdlet.RemoveSearchTopology

    Old topology deleted
    Done – start a full crawl and you are good to go (search).

    Reply
    • Max Melcher says:

      You get the error “The search service instance on this server is
      not online” – to fix it you can do the following:

      Go to “Services on this server” and start the search service or do it the powershell way:
      Start-SPEnterpriseSearchServiceInstance

      I will update my script soon so that it handles it.

      Thanks for your feedback!
      Max

      Reply
  6. matthew Moore says:

    I am confused on part 10 and 11. What do i actually put. The sharepoint server is called sharepoint and i have the database on the same computer. What do i need to put in 10 and 11 ?

    Reply
    • Max Melcher says:

      Hi Matthew,

      sorry the comments are not “there yet” 🙂

      Try localhost in 10 – thats your server name.
      You can keep 11 – thats the database that will be created.

      Cheers,
      Max

      Reply
  7. jen says:

    Thank you, thank you, thank you. This is the only scipt I used that actually worked – the first time! My quest was to only have databases wtihout GUID. I had no idea how painful creating and configuring Search would be in 2013. Thanks to you I can now relax the rest of my weekend. 🙂

    Reply
  8. Istvan says:

    Hello!

    The missing lines. The search PS script will be work. Insert before row 22.
    (New-SPEnterpriseSearchServiceApplication : Value cannot be null.)

    $SearchServer = “yourservername””
    Write-Host -ForegroundColor Yellow “Set index location”
    $SearchServer | % {
    $svcInst = (Get-SPServer -Identity $_).serviceinstances | ? { $_.GetType().FullName -eq “Microsoft.Office.Server.Search.Administration.SearchServiceInstance” }
    $svcInst.DefaultIndexLocation = $IndexLocation
    $svcInst.Update()
    $svcInst.Provision()
    }

    Reply
  9. Eshetu says:

    I got this exception after the activate script, pls help
    Write-Host -ForegroundColor Green “Activating new topology”
    $SearchTopology.Activate()
    —–
    Exception calling “Activate” with “0” argument(s): “Topology activation failed. No system manager locations set,
    search application might not be ready yet.”
    At line:1 char:1
    + $SearchTopology.Activate()
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : SearchTopologyActivationException

    Reply
  10. Eshetu says:

    Yes it is running.

    Reply
  11. Eshetu says:

    Search Host Controller Service Started Stop

    Reply
  12. Eshetu says:

    Hi Max,

    I installed all the KBs mentioned and run the provision usage script as follows with no error.
    $UP = Get-SPServiceApplicationProxy | where {$_.TypeName -like “Usage*”}
    $UP.Provision()

    But the error still exist. I can’t locate Usage Proxy on the central administration page. Would you help me on that.

    The other thing I observe on the uls viewer is that I got this error message several times.

    mssearch.exe SharePoint Server Search
    Crawler:Content Plugin Critical
    Content Plugin can not be initialized – list of CSS addresses is not set.

    Any idea on this?

    Thank you so much

    Reply
    • Max Melcher says:

      Go to Central Admin – remove the Search Service Application created by my script and create it again – this time in the Central Admin with the wizard. See if that works (then its the scripts fault) – if it doesnt, you did something wrong setting up the server.

      Reply
  13. Alex says:

    I am having an issue where I get the following error when opening the search application:

    The search service is not able to connect to the machine that hosts the administration component. Verify that the administration component ‘12264556-dc30-4832-b081-cfbd98bb0028’ in search application ‘Search SA’ is in a good state and try again.

    Whether I install search using powershell or via CA, I get the same error. What can I do to fix this?

    Running SharePoint 2013 Enterprise on Server 2012. Using SQL Alias SPSQL and changed line to reflect that.

    Reply
  14. Alex says:

    I have tried that solution, doesn’t seem to make a difference. I am using the farm account trying to get around database security issues, which that SA has all the access in the world at this point in time. I have searched for over 15 hours trying to figure this one out but it may have something to do with the fact that I scripted the install and something probably got missed, I used the SPAutoInstaller script, and for some reason no services got provisioned during the install. Now the two updates, the Pu and CU wont finish during psconfig, errors out at step 9/10. UGH Thanks for your help

    Reply
    • Max Melcher says:

      Hey Alex,

      it sounds like you need troubleshooting.
      Please write me an email (contact form) so that we can discuss the details.

      So long,
      Max

      Reply
  15. Marcel Jeanneau says:

    Hi Max! Your script is amazing! Thank you for that!
    I have a question: what if I need to make the 4 search databases mirroring-aware? I mean, it’s obvious that I have to do all the plumbing on the SQL side but what about in the SharePoint side? I don’t see any parameter in the New-SPEnterpriseSearchServiceApplication to specify a failover database server. I don’t find any documentation for this in TechNet either. Any clues? THANK YOU!

    Reply
    • Max Melcher says:

      Hey Marcel,

      thanks for your feedback – you made my day!

      AFAIK you dont need the mirroring awareness in the service application and only certain types of mirroring are supported: http://technet.microsoft.com/en-us/library/jj841106.aspx#SAppDBsSPALL

      So long,
      Max

      Reply
      • Marcel Jeanneau says:

        Thank you for your quick reply Max. I’m aligned with the supportability statements –I’m using high safety mode for all DBs 🙂

        Besides of that, I’ve found that Set-SPEnterpriseSearchServiceApplication might do the trick –it provides the FailoverDatabaseServer parameter. According to the article (http://technet.microsoft.com/en-us/library/ff607974.aspx):

        This cmdlet updates properties of a search service application. SPEnterpriseSearchServiceApplication represents a self-contained aggregation of indexed content and properties available for search, and provides an anchor class for setting global search properties.

        From this, I might *asume* that it could set the FailoverDatabaseServer for all 4 search databases.

        Also, I’ve found that you can accomplish this individually for at least 2 of them:
        – Crawl database: Set-SPEnterpriseSearchCrawlDatabase (it provides the FailoverDatabaseServer parameter)
        – Links database: Set-SPEnterpriseSearchLinksDatabase (it also provides the FailoverDatabaseServer parameter)

        However, I don’t find similar cmdlets specifically for Search Admin database nor for Analytics database.

        Based on how databases are handled in this article: Move the Search service application databases in SharePoint 2013 (http://technet.microsoft.com/en-us/library/jj729803.aspx#PS) I can see that all search databases are treated differently. Actually, from this article I might assume:
        – Search Admin database: Set-SPEnterpriseSearchServiceApplication –I know, I assumed that this might do the trick for all 4 DBs
        – Analytics database: ???? –it is treated as a SPServerScaleOutDatabase object, however there is no Set-SPServerScaleOutDatabase cmdlet available 

        Any ideas?

        Reply
  16. Mahfuz R Sumon says:

    Hi Max,

    Thanks a lot for this script. This works like a charm. But I have one error at the end as below “can not synchronize non-activated topology.” if it is not necessary to be synced can it be taken out from the script? I don’t like to see any error with red line..!!

    appreciate your prompt response.

    Below are the error:-
    =======================================================
    Activating new topology
    Next call will provoke an error but after that the old topology can be deleted –
    just ignore it!
    Exception calling “Synchronize” with “0” argument(s): “Cannot synchronize
    non-activated topology.”
    At D:\Scripts\Install\SPSearch.ps1:59 char:1
    + $InitialSearchTopology.Synchronize()
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : InvalidOperationException

    Deleting old topology
    Old topology deleted
    Done – start a full crawl and you are good to go (search).
    PS D:\Scripts\Install>
    =====================================================

    Reply
  17. Brett says:

    Worked flawlessly where others failed. Great work!

    Reply
  18. Chad C says:

    I too got the “The search service instance on this server is not online” error. So I went into CA and then to Manage Service applications and noticed that the Search Service Account was actually using the Crawl managed account. I changed this to use the Search account instead, then re-ran the script – it ran without errors.
    However, I went back into CA and noticed that now the Search Service was using the farm account. I would *try* to change it in the Edit Search Service Application, but every time I went back, it reverted to the farm account. So, I then went to Service Accounts and associated Windows Service – SharePoint Server Search Service with the proper Search service account – and this held.
    I think the script chooses from managed accounts somewhat randomly (I’m using this site also http://consultingblogs.emc.com/randyrempel/archive/2013/03/17/installing-and-configuring-sharepoint-2013-part-4-of-4.aspx) , and so it may be necessary to go into CA to associate the appropriate accounts with the search service. In any case, thank you Max for a handy bootstrap script!

    Reply
  19. Johnk525 says:

    Muchos Gracias for your blog post. afdecdddabbe

    Reply
  20. RK says:

    Does this script creates the search application in the Frontend server or Application servers? What about the other 3 databases created as part of SSA. Can we name them also using this script?

    Reply
    • Max Melcher says:

      Hey RK,

      The Search Service Application is provisioned within the farm – not on a special server. Then there is the topology where you provision search services on servers.
      In this script I provision everything on one server, you can adjust or relayout them later.
      Out of my head: the other two databases can not be named individually, they will be named like the first one.

      So long!
      Max

      Reply
  21. Matt says:

    One thing I cannot seem to find is how to provision multiple application pools during the process. According to MS there should be an Admin pool and a Query pool. Both can be set up to use the search service account.

    Anyone know how to add multiple pools when creating a new search application?

    Reply
    • Max Melcher says:

      Hi Matt,

      Thanks for your comment – very interesting, you are right.

      Do you have a reference for the “according to ms” part?
      I usually provision both in one app pool and I have no indications that this is bad.

      Cheers
      Max

      Reply
  22. Kelly Smith says:

    Max, can you help me with modification of this script for a two server farm?

    Reply
    • Max Melcher says:

      Hi Kelly,

      you basically have to adjust line 44, line 45 and line 53 where you create the Query, Crawl and Index Components – duplicate the lines with different SearchServiceInstances and you should be fine.
      Or you can take Matthew MCDermott’s script with some more options and a handy config: http://melcher.it/s/3a

      Cheers!
      Max

      Reply
  23. Paul says:

    After working through some errors, it is just sitting at:

    Creating Search Service Application; for 5 minutes.

    Any ideas?

    Reply
  24. Paul says:

    Activating new topology
    Exception calling: “Activate with “0” arugment(s): “The search service is not able to connect to the machine that hosts the administration component. Verify that the administration component ‘sdfsf-sdfasdf-sadfsadf-asdfasd’ in search application ‘Search SA’ is in a good state and try again.”

    Reply
  25. Bernd says:

    The script is stuck at “Activating new topology” and ULS gives me the dreaded “Content Plugin can not be initialized – list of CSS addresses is not set.”

    When I create the search topology via the GUI Wizard I do not get this error.

    Any advice?

    Reply
    • Max Melcher says:

      Hey Bernd,

      you will see “Content Plugin can not be initialized – list of CSS addresses is not set.” until the Search Service is set up correctly. Depending on the speed of your current environment (ram & cpu & sql io) that can take up to 15 minutes. Did you wait that long?
      It should not take longer than the GUI provisioning.

      So long!
      Max

      Reply
  26. K says:

    Hi Max,

    I have already one search service created on the test server. Its working fine.

    I want to create another using this script for testing. Can I create another on the same server?

    Thanks
    KP

    Reply
  27. K says:

    Hi Max

    I have deleted old search service application created using central admin. It wasn’t working.
    “Unable to retrieve topology. Admin component is not working.”
    I have recreated using CA. Same problem.

    Finally start using Powers shell command.
    I tried your script. Its stops at Activating new topology
    Below error:
    Exception calling “Activate” with “0” argument(s): “Topology activation failed. No system manager locations set,

    Any idea.

    Thanks
    KP

    Reply
    • Max Melcher says:

      Hey K,

      Delete that service application, then restart the services:
      •SharePoint Search Host Controller
      •SharePoint Server Search 15

      Then try my script again.

      Good luck!
      Max

      Reply
      • K says:

        Hi Max,

        Thanks
        Actually I have changed the sp_search account for the SharePoint Search Host Controller. Before it was different than the ‘Default content access account’. Then tried your script. Its all worked.

        Thanks a lot.

        My site URL is added into below list
        ‘Start Addresses
        Type the URLs from which the search system should start crawling.’

        Its not searching for the site. Get message as below.
        ‘Nothing here matches your search’

        Can you help please.

        Thanks again,
        KP

        Reply
        • Max Melcher says:

          Check the crawl log if the site was indexed – does the default content access account have access to the site?

          Reply
          • K says:

            Hi Max,

            Thanks for your help!

            You are correct. Checked crawl log and found access denied to crawl database….error
            Finally worked out that it required to add registry key for the URL Host header in SharePoint server.

            At Last allowed crawl search database and search is working now.

            Thank you so much for this script. I liked using Power Shell script rather then create search service in CA.

            KP

    • Max Melcher says:

      Glad it works!

      Reply
    • K says:

      Hi Max,

      One Question:

      Since search is working performance is slow.
      I have read few blogs regarding performance that it needs to set memoryLimitMegabytes to some value in NodeRunner.exe Config can make faster search.

      Can you please advise on this.
      Thanks
      KP

      Reply
      • Max Melcher says:

        How many servers do you have? What crawl schedule do you have?

        Reply
        • K says:

          HI Max,

          It was different issue.

          It’s all good now.

          Thanks
          KP

          Reply
          • K says:

            Hi Max,

            Need you help again after long time.
            I have created new web application. The database version is 15.0.4763.1000. Search crawl is not working for this site. Also search service application topology showing as below message “Could not connect to the search administration Web service on server because the web server is not running.”

            Also I updated recent patch on this server which is
            “October 2015 15.0.4763.1000, KB3085492 October 13, 2015 cumulative update for SharePoint Server 2013”
            And noticed Database server version is not updating “Configuration database version:
            15.0.4641.1000 ”

            Whenever I create new site I get this problem. How would deal with it.

            Regards
            K

          • Max Melcher says:

            Hey Kaviita,

            Did you run psconfig? Sounds like your apppool running search is dead or something. There must be a pointer in uls logs.

            Cheers
            Max

        • K says:

          Hi Max,

          I didn’t run psconfig as last time I had an error. I assume when windows update run automatically it fixes all version problem automatically

          RegardsK

          Reply
          • Max Melcher says:

            You always have to run psconfig once a SharePoint patch or security update was installed, see this one: http://melcher.it/s/62

            Not calling psconfig can cause severe issues – and search will be very sad!

          • K says:

            Hi Max,

            I ran SharePoint Product Wizard Configuration.
            Every time I run this wizard I get below error message and It get failed.

            At Step 8 of 9
            Failed to upgrade SharePoint Products
            An exception of type Microsoft.SharePoint.PostSetupConfigurationTaskException was thrown.

            Could you suggest any solution to resolve this.
            Thanks
            K

          • Max Melcher says:

            Ok, run it again – sometimes it need needs two runs to complete.
            If it does not work, go to the log file and search for ERR.

  28. KP says:

    Hi Max,

    Question: SharePoint Server 2013, Active Directory Groups and the access denied problem caused by token lifetime.

    Removing and Adding user into the AD Group doesn’t reflect the permission straight into the SharePoint Site.

    I have searched around. Suggested solution found to change the windows token expiration time.
    I am not sure is this a good solution or keep it for default 10 hours?

    Could please advise on this. Or let me know the solution..

    Thanks
    KP

    Reply
  29. K says:

    Hi Max,

    I didn’t run psconfig as last time I had an error. I assume when windows update run automatically it fixes all version problem automatically

    Regards
    K

    Reply
  30. KP says:

    Hi Max,

    Help again.
    In our production Share Point site few custom Lists are growing and reached to 5000 threshold limit.
    I had a look few options as below.
    1. Create Index – but don’t prefer as it expand resources.
    2. Create Filtered View- Created already Warning message is still there.
    3. Increase Threshold Limit – Not sure about performance of the site

    What is the best option to resolve it.

    KP

    Reply
    • KP says:

      Hi Max

      I have URLs set up for SSL Certificates and set up alternate URL for https.

      Both http and https URLs are in the Local SharePoint search content source.

      Its not crawling into search service application.
      I have checked search account has access to Database.
      Search service is working fine as other URLs http are working.

      Looked into Event viewer. get below warning.

      The start address https://srv.com.au cannot be crawled. All other URLs are working fine which are http.

      Context: Application ‘Search_Service_Application’, Catalog ‘Portal_Content’

      Details:
      Access is denied. Verify that either the Default Content Access Account has access to this repository, or add a crawl rule to crawl this repository. If the repository being crawled is a SharePoint repository, verify that the account you are using has “Full Read” permissions on the SharePoint Web Application being crawled. (0x80041205)

      Any solution?

      Reply
  31. Haritha says:

    Hi Max,
    Thank you for providing the deep description part about the creation of sharepoint service. By reading your blog post i gained more information. Thanks a lot for posting unique information and made me more knowledgeable person. Keep on blogging!!

    Reply
  32. Sam says:

    Hello,
    Firstly, thank you for this script! I am having some issues though, when I ran it against an SP 2016 instance, the creation of the search service hung indefinitely. I then created the search service from Central Administration, and ran the script again to create the rest of the configuration. The script errs out when creating the new topology with “The search service is not able to connect to the machine that hosts the administration component.” I encountered this error as well in Central Administration when creating the search service.

    Any thoughts would be appreciated! I have exhausted all the recommendations I could find in the forums.

    Thanks much!

    Sam

    Reply
  33. Salman Haleem says:

    Hi

    After a lot of searching, your script was by far the most easiest to use.
    Only they application pool variable was throwing error, and I replaced it by the actual pool name, worked fine.

    Thanks a lot !

    Salman Haleem

    Reply
  34. JL says:

    Many thanks for this script, it is the first one which gets the job done for me.

    Reply
  35. Max Melcher says:

    Hey Salman,

    Thanks for your feedback – you made my day!

    Cheers!
    Max

    Reply
  36. Max Melcher says:

    Thanks JL – I am glad to hear that! Still, the script could need some love, some cases are not covered at all… 🙂

    Cheers
    Max

    Reply

Trackbacks & Pingbacks

  1. […] Si l’erreur suivante survient , vous pouvez utiliser un script pour recréer correctement la topologie  (https://melcher.it/2012/07/sharepoint-2013-create-a-search-service-application-and-topology-with-pow&#8230😉 […]

  2. […] I was able to correct the crawling issue by recreating the SSA – I followed a guide here, cleared the index and ran a full crawl and it completed indexing 9,000+ items in less than an […]

  3. […] #SharePoint 2013 – Create a Search Service Application and Search Topology with Powershell […]

  4. […] RHR (2012/04/25): I tried running a PowerShell script to do so that I downloaded the PowerShell script from http://melcher.it/2012/07/sharepoint-2013-create-a-search-service-application-and-topology-with-powe…. […]

  5. […] you provisioned the Search Service with my powershell script – then you can customized the Index Location with the $IndexLocation variable in the settings […]

  6. […] script has been tested and feedback from Max Melcher incorporated. Thanks […]

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close