Create a powershell script (task1.ps1) with code below
if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null)
{
Add-PSSnapin Microsoft.SharePoint.PowerShell -Verbose -ErrorAction:Stop
}
#the $True parameter denotes: Disable Alerts and Ignore Timeout error.
(Get-SPEnterpriseSearchServiceApplication).reset($true, $true)
Add a new task in your task scheduler
Check the radio button 'Run whether user is logged on or not
Set a name and add a trigger to set scheduling
set the action : program / script
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe
argument with -command followed by the pass to your powershell script
-executionpolicy unrestricted -command D:\PS1\Task1.ps1
Save your task