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:
I quickly realized that SQL Browser was disabled. Once I enabled it and ran sqlcmd -L, I got the below result:
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.