2

To put it short, the file server's index would fail randomly.

The file server has Windows Search service enabled and indexed. There are many clients connected to this server, possibly up to 100. The client Windows (7/10) machines would fail to search the server. Green bar keeps going and going with no result shown.

On the server, it can be resolved by simply restarting the Windows Search (Wsearch) service. It would take a long time (like a minute) to stop/restart. When "stopped", it would throw out an error saying the service cannot be stopped. Below is the error thrown stopping the service from powershell.

Stop-Service : Service 'Windows Search (Wsearch)' cannot be stopped due to the following error: Cannot stop Wsearch
service on computer '------'.
At C:\Users\------\Documents\PSscript\Wsearch-stop.ps1:4 char:54
+ Get-Service -Name $svc_name -ComputerName $pc_name | Stop-Service
+                                                      ~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (System.ServiceProcess.ServiceController:ServiceController) [Stop-Service],
   ServiceCommandException
    + FullyQualifiedErrorId : CouldNotStopService,Microsoft.PowerShell.Commands.StopServiceCommand

Sometimes it won't fail but it could also fail many times per day. We haven't been able to find out the culprit and have to restart it upon request. File operations are unhindered.

edit: I wonder if anyone had such problem. I found nothing on the net. My current solution is try to make a script to query the network index from a client computer and when found error, restart the service.

Alf
  • 33
  • 4

1 Answers1

2

Look at event log on the client machine and find the time when the indexing search failed. You can create a special scheduled task which will be triggered by a needed event and will run PS script. My colleague wrote a sample for you:

Enter-PSSession -ComputerName "example-server.domain.local"

Set-Service "WSearch" -StartupType manual

Get-Service -Name "WSearch" | Format-List -Property Name, DependentServices |

Out-Null

Stop-Service -Name "WSearch" -Force -Confirm

Start-Service -Name "WSearch" -Confirm

SearchIndexer.exe

Stuka
  • 5,181
  • 13
  • 11
  • 1
    Thanks for mentioning the event log. I cannot find any log on the clients when search failed. However on the server it has 7011 service timeout. I can use that as trigger point. It's a bandage but at least a step forward. Marking this as solved but still welcome any solution. – Alf Mar 12 '18 at 14:41