Poweshell: how to retreive service accounts from services for many servers

Below a sample script

$hosts = Get-Content "hosts.txt"
foreach ($myhost in $hosts) {
  Get-WmiObject win32_service -ComputerName $myhost|where {$_.StartMode -eq "Auto"} | where {$_.StartName -like "*.*"} | foreach {write-host $myhost, $_.Startname}
}