SQLCMD -L Not Listing Your Servers? Try This

I was recently playing around with sqlcmd and wanted to list the SQL Servers on my server. When I ran “sqlcmd -L” I got the below output:

sqlcmd-L not working

I quickly realized that SQL Browser was disabled. Once I enabled it and ran sqlcmd -L, I got the below result:

sqlcmd-L working

Per Microsoft: “SQL Server Browser listens for incoming requests for Microsoft SQL Server resources and provides information about SQL Server instances installed on the computer” (MSDN)

So sqlcmd uses SQL Server Browser service to gather information on SQL Servers. If SQL Server Browser is off, then you can’t use sqlcmd -L.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.