Com base nos seus comentários, aqui está o script que eu usaria para esse cenário:
# Gettings the server list from text file
$servers = Get-Content c:\servers.txt
# Creating an empty array
$array = @()
# Starting the loop for each server in the list
foreach ($server in $servers)
{
# Getting the server's IP. Other methods could apply
$IP = [System.Net.Dns]::GetHostAddresses("$server").IPAddressToString
# Getting the list of services
$services = Get-Service -ComputerName $server -Name I*
# Starting the loop for each service in the list
foreach ($service in $services)
{
# Creating a new PS object and adding values
$Object = New-Object PSObject
$Object | Add-Member -MemberType NoteProperty -Name "Hostname" -Value $server
$Object | Add-Member -MemberType NoteProperty -Name "IP" -Value $IP
$Object | Add-Member -MemberType NoteProperty -Name "Service" -Value $service.Name
$Object | Add-Member -MemberType NoteProperty -Name "Status" -Value $service.Status
#Feeding the array with the values
$array += $Object
}
}
# Now converting the array to HTML
$array | ConvertTo-Html -Head $htmlhead | Out-String
No console, o array $ seria expandido assim:
Por favor, tente nos informar se ele atende às suas necessidades. Você pode ter que se adaptar de acordo com o seu ambiente.
Espero que isso ajude!