I'm not sure if this is exactly what you're looking for but if you store the services you need in a text file you can do the following:
$services = Get-Content "C:ServiceList.txt"
$statusReport = Get-Service -Name $services | Select-Object Name, Status
$statusReport | Out-File -path "c:logfile.log"
Result:
Name Status
---- ------
spooler Running
winrm Stopped
wsearch Running
The name parameter in Get-Service -Name $services
accepts an array of strings, which is why you don't need to do any sort of 'foreach' loop.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…