I've been working at this script for a while and I can't seem to figure it out:
$servers = Get-Content -path c:\users\jason\documents\skyperservers.txt
Foreach ($server in $servers){get-cswindowservice -computername $servers | where-object {$_.status -eq "running"}}
I keep getting the error
Get-CSWindowService : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'ComputerName'. Specified method is not supported...
Essentially, I'm trying to display all services from the command for each skype server and their service health status whether "running" or "stopped"
Two things about your code:
$serversusing variable$server, but you do not use that as parameter for the Get-CSWindowService cmdlet. Instead you feed it the entire collection $servers (System.Object[]), which is what the error is telling you.Try
Now you can display the results on screen
or for instance save the results to a Csv file