List all SQL Servers running on your Domain using a single command

Sometimes you want to find all the SQL servers running on your Domain with one quick command. SQLCMD providess facility to do so. Your client workstation should have Microsoft SQL server client installed on it for SQLCMD to work.

1. Go to Command Prompt. If you are on Windows Server 2008. Right Click Command Prompt and say “Run as Administrator”

2. At thepromp type:

SQLCMD -L

This will list all the SQL servers running on your network.

3. To save as csv file

SQLCMD -L > allservers.csv

Advertisements