Use hybrid approach:
function Restart-VMHostNTPService
{
[CmdletBinding()]
[OutputType([int])]
Param
(
# Param1 help description
[Parameter(Mandatory=$true,
ValueFromPipelineByPropertyName=$true,
Position=0)]
[ValidateNotNullOrEmpty()]
[Alias("Name")]
[string]$VMHost
)
Process
{
Get-VMHostService -vmhost $VMHost | ? {$_.Key -eq 'ntpd'} | Restart-VMHostService -confirm:$false
}
}
Get-VmHost -name host* | Restart-VMHostNTPService
Specify any filter you want using PowerShell capabilities like Where-Object, regular expressions and so on and pipe all this to function.