Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My SQL Server's instance name is SQLEXPRESS and SQL Server Service Name looks like MSSQL$SQLEXPRESS. Is there any relation between instance name and service name? I'm trying to check SQL Server Service Status by name and I wonder can SQL Server Service name be different on another computers?

share|improve this question
up vote 11 down vote accepted

Yes, the service name is always MSSQL$<Instance Name> for a named instance and MSSQLSERVER for a default instance. I don't believe either can be altered or overridden, nor can I think of any reason why you'd want to.

You can enumerate the installed instances on a server via the registry, using Powershell for example:

Get-ItemProperty 'HKLM:\Software\Microsoft\Microsoft SQL Server\Instance Names\SQL'
share|improve this answer
+1 on your answer. I've added another answer to show a second way to get the desired information on service states. – Thomas Stringer Jan 3 '14 at 18:59

Mark showed you a way to get this information directly from the registry, but another way to do this would be through WMI, consumed by PowerShell:

Get-WmiObject -ComputerName "YourDestinationServer" -Namespace "root\microsoft\sqlserver\computermanagement11" -Class "SqlService" |
    Where-Object {$_.SQLServiceType -eq 1} |
    Select-Object ServiceName, DisplayName, 
        @{Name = "StateDesc"; Expression = {
            switch ($_.State) {
                1 { "Stopped" }
                2 { "Start Pending" }
                3 { "Stop Pending" }
                4 { "Running" }
                5 { "Continue Pending" }
                6 { "Pause Pending" }
                7 { "Paused" }

The above command will give you the state of the SQL Server engine service(s) on a particular machine.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.