Why do you want to do that? Leave them enabled and then use a hosts file on the Search servers to target the search crawl at the App Server(s).
How to disable "Microsoft SharePoint Foundation Web Application" on App servers using powershell?
I configured SharePoint 2019 On premise farm with following server roles. "Microsoft SharePoint Foundation Web Application" runs on all servers.
2 - WFE servers with MinRole
2 - Search servers with Application with Search MinRole
2 - App servers with Application MinRole
Do I need to change MinRoles to "Custom" on App and Search servers? How can I change MinRole to "Custom" without impacting what is configured on these App and Search servers?
How do I limit "Microsoft SharePoint Foundation Web Application" run on WFE servers only using PowerShell?
This command will give me details on where "Microsoft SharePoint Foundation Web Application" running in farm
Get-SPServiceInstance | where {$_.TypeName -like "Foundation Web"} | select ID, Name, Server, Status
$svc = Get-SPServiceInstance | where {$_.ID -like "GUID from earlier step"}
$svc.Status = "Offline"
$svc.Update()
or
Stop-SPServiceInstance $svc
or
$ServiceName = "Microsoft SharePoint Foundation Web Application"
Get-SPServiceInstance -server $env:COMPUTERNAME | where-object {$_.TypeName -eq $ServiceName} | Stop-SPServiceInstance -confirm:$false > $null
Do I need to remnants of SharePoint sites in IIS Manager after removing "Microsoft SharePoint Foundation Web Application" service?