Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Add-PSSnapin *share* -ErrorAction SilentlyContinue
  2.  
  3. #Find the Search Service that we are changing the topology - note the ID
  4. Get-SPEnterpriseSearchServiceApplication
  5.  
  6. #----------------------step1----------------------------------------------#
  7.  
  8.  
  9. write "please run only step 1"
  10. #variables
  11.  
  12. $q3="SD5-Query03"
  13. $q4="SD5-Query04"
  14. $ssaID = <INSERT_Search_Service_GUID_HERE>
  15.  
  16.  
  17. $hostC = Get-SPEnterpriseSearchServiceInstance -Identity $q3
  18. $hostD = Get-SPEnterpriseSearchServiceInstance -Identity $q4
  19.  
  20.  
  21.  
  22.  
  23. $ssa = Get-SPEnterpriseSearchServiceApplication -Identity $ssaID
  24. $active = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Active
  25. $clone = New-SPEnterpriseSearchTopology -SearchApplication $ssa -Clone -SearchTopology $active
  26.  
  27. #add index partition 1 to query servers
  28. New-SPEnterpriseSearchIndexComponent -SearchTopology $clone -SearchServiceInstance $hostC -RootDirectory "E:\SP13_Index01" -IndexPartition 1
  29. New-SPEnterpriseSearchIndexComponent -SearchTopology $clone -SearchServiceInstance $hostD -RootDirectory "E:\SP13_Index01" -IndexPartition 1
  30.  
  31. #activate topology
  32. $clone.Activate()
  33.  
  34. #-------------------------step2 - RUN ONLY AFTER THE NEW SEARCH SEARVICE IS IN PRODUCTION-------#
  35.  
  36. #Find the OLD Search Service that we are REMOVING - note the ID
  37. Get-SPEnterpriseSearchServiceApplication
  38.  
  39. #variables
  40. $wfePrefix = "SD5-FE"
  41. $ssaID = <INSERT_OLD_Search_Service_GUID_HERE>
  42.  
  43. $answer=read-host "Are you sure you want to run step 2? y/n"
  44. if($answer -eq "y")
  45. {
  46.  
  47.     $ssa = Get-SPEnterpriseSearchServiceApplication -Identity $ssaID
  48.     $active = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Active
  49.     $clone = New-SPEnterpriseSearchTopology -SearchApplication $ssa -Clone -SearchTopology $active
  50.  
  51.     #remove search components from WFEs
  52.     Get-SPEnterpriseSearchComponent -SearchTopology $clone | ? {$_.ServerName -like "*$wfePrefix*"} | %{
  53.  
  54.     Remove-SPEnterpriseSearchComponent -Identity $_.ComponentId.GUID -SearchTopology $clone -Confirm:$false
  55.  
  56.     }
  57.     #activate topology
  58.     $clone.Activate()
  59.  
  60.     #stop search services on WFEs
  61.     Get-SPEnterpriseSearchServiceInstance | ? server -like "*$wfePrefix*" | Stop-SPEnterpriseSearchServiceInstance
  62.     Get-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance | ? server -like "*$wfePrefix*" | Stop-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance
  63.  
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement