List of SQL Server instances currently installed in your network | SansSQL

Thursday, February 18, 2010

List of SQL Server instances currently installed in your network

To get a list of SQL Server instances currently installed in your network, execute either of the below commands

Exec xp_cmdshell 'SQLCMD /L'
OR
Exec xp_cmdshell 'OSQL /L'


If you want to populate a text file with the results then, open the command prompt (Go to Run, Type cmd and click ok) and type this command and hit enter
SQLCMD /L > C:\ListOfServers.txt
This command will populate the text file ListOfServers.txt with the results obtained from SQLCMD /L

No comments:

Post a Comment