I'm trying to run a morning check to ensure that all SolarWinds and SQL based services are running within the environment.
I've got this far with it and it isn't working at the moment;
$myServiceArray=@()
$myServiceArray="*Solar*","*SQL*"
Foreach($Service in $myServiceArray){
Try {
$servers = Get-Content "C:\SolarWinds\PowerShell\TEST.txt"
$Result=Get-Service -ComputerName $servers -Name $Service |Select Hostname,Service,Status > C:\SolarWinds\PowerShell\Results.txt
}
And I'm getting this within the text file;
Hostname Service Status
-------------- ---------- --------
Running
Stopped
Running
Stopped
Would appreciate any help to get this working.
Thanks