Use the same line, just add the "-ComputerName".
This:
Get-WmiObject win32_service | where {$_.DisplayName -match "SQL Server"} | select Name, DisplayName, State, StartName
Equates to this for running it on my local machine:
Get-WmiObject win32_service -ComputerName localhost | where {$_.DisplayName -match "SQL Server"} | select Name, DisplayName, State, StartName
You use the same command and pipeline commands, just adjusting for running it remotely. So your command would just be:
Get-Service -ComputerName $ComputerName -Name SQL* | select Name, DisplayName, State, StartName
Shawn Melton
Twitter: @wsmelton
Blog: wsmelton.github.com
Github: wsmelton