In SharePoint you decide where the Gatherer Service log files are stored at installation time.  If you decide wrong for whatever reason you can use this script to correct the problem.

Things to know:

1. This is supported for SharePoint 2016 installations

2. There will be a short service interruption at the end when OSearch16 is restarted

3. You should run this on all Search servers

4. Modify the variable $NewTempPath to work for your enterprise

 

PowerShell
Edit|Remove
Add-PSSnapin Microsoft.SharePoint.PowerShell -ea SilentlyContinue 
 
$ssa = Get-SPEnterpriseSearchServiceApplication 
$Topo = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -active 
Get-SPEnterpriseSearchComponent -SearchTopology $Topo  
 
$NewTempPath = "D:\SearchTemp" 
 
New-Item -Path $NewTempPath -ItemType Directory -ErrorAction SilentlyContinue 
 
$GMPath = "HKLM:\SOFTWARE\Microsoft\Office Server\16.0\Search\Global\Gathering Manager" 
 
Get-ItemPropertyValue -Path $GMPath -Name DefaultApplicationsPath 
Set-ItemProperty -Path $GMPath -name DefaultApplicationsPath -Value $NewTempPath 
 
Get-ChildItem -Path "HKLM:\SOFTWARE\Microsoft\Office Server\16.0\Search\Components" | ForEach-Object { 
    $RegPath = ($_.Name).Replace("HKEY_LOCAL_MACHINE","HKLM:") 
    Get-ItemPropertyValue -Path $RegPath -name LocalStoragePath 
    Set-ItemProperty -Path $RegKey -name LocalStoragePath -Value $NewTempPath 
}