#2013-08-26 更新#Author: ZhongDaoXueYou#Copyright: 反正也是抄微软的, 大家随便用.#Routine Starts Hereif ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) { Add-PSSnapin "Microsoft.SharePoint.PowerShell"}$hostA = Get-SPEnterpriseSearchServiceInstance -Identity "APP1-SPS2013"$hostB = Get-SPEnterpriseSearchServiceInstance -Identity "APP2-SPS2013"Start-SPEnterpriseSearchServiceInstance -Identity $hostAStart-SPEnterpriseSearchServiceInstance -Identity $hostB#Wait until all the search service instances are running#Commands below should return "Online" for both servers.Get-SPEnterpriseSearchServiceInstance -Identity $hostAGet-SPEnterpriseSearchServiceInstance -Identity $hostB$ssa = Get-SPEnterpriseSearchServiceApplication$newTopology = New-SPEnterpriseSearchTopology -SearchApplication $ssa#Topology:#APP1: AdminComponent, CrawlComponent, ContentProcessingComponent,AnalyticsProcessingComponent#APP2: QueryProcessingComponent, IndexComponentNew-SPEnterpriseSearchAdminComponent -SearchTopology $newTopology -SearchServiceInstance $hostANew-SPEnterpriseSearchCrawlComponent -SearchTopology $newTopology -SearchServiceInstance $hostANew-SPEnterpriseSearchContentProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostANew-SPEnterpriseSearchAnalyticsProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostANew-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostBNew-SPEnterpriseSearchIndexComponent -SearchTopology $newTopology -SearchServiceInstance $hostB -IndexPartition 0#To prevent error message "Topology activation failed. Each partition must have at least one index component..."#"...from the previous topology in the new topology.",#You may need to reset index in your test environment before you move on.#Activate the new search topologySet-SPEnterpriseSearchTopology -Identity $newTopology#Verify that the new search topology is active, and get the old topology's IDGet-SPEnterpriseSearchTopology -SearchApplication $ssa#Remove the old topology object. Replace the ID with your own$oldTopology = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Identity 35ef8906-b5f2-48bf-a3e5-8b53bdcb69eaRemove-SPEnterpriseSearchTopology -Identity $oldTopology#Verify that all components of the new search topology are running correctlyGet-SPEnterpriseSearchStatus -SearchApplication $ssa -Text
运行结果
2013-08-26 更新 运行完脚本后, 可能会发现有些component(比如Index component需要拷贝索引, Admin component需要一些额外的配置)的状态是黄色的三角叹号, 不用担心, 等一下就会变为正常的绿色小勾了.
如果长时间保持黄色的叹号图标, 请检查你的index分区是否还有足够空间. 如果还不行, 就得查看SharePoint 日志排错了.
参考资料
=======================
Add Microsoft.SharePoint.PowerShell Snap-In to All PowerShell Windows
Change the default search topology in SharePoint Server 2013