So, I’ve been challenging myself to use remote sessions less and use Powershell more for remote SQL Server administration tasks.

I’m hoping to create some posts with some useful scripts I’ve created, starting today with a simple script to grab all SQL Server related services and some basic information, from a remote server.

Get-WmiObject -ComputerName SERVER1 win32_service | Where-Object {$ -like "*sql*"} | Format-Table name, DisplayName, Startname, State

This could easily be turned into a function and given a list of servers to go through and check, you could just add the host name to the Format-Table cmdlet.  I built this script to identify the credential used to start the services as I wanted to use different credentials for each service rather than the same one for all SQL Server services across our entire estate.