Archive: Detect MsSQL


Detect MsSQL
I need to detect MsSQL on the network.
I don't mean to go to the regestry on the local PC, but to see the list of SQL servers installed on the network.

If for example you run on your PC "SQL Server Service manager" you have there a dropdown list of all the servers on your nework.

Is it possible to do sometihng like this with NSIS ?


Imho there are different ways to find the SQL Servers, depending on the

If there is an SQL Server or a Desktop Engine on the Machine you run the Setup, there will be the OSQL.exe which allows you to run SQL-Statements.

this Page shows how to Do this with a Statement, but I think there are many other Pages which show it a bit different, maybe easier too. So if you have a statement like this, you can get the Serverlist by running the OSQL.exe from nsexec or something like that.


Another Option would be, to use the Microsoft SQLDMO Object Library (just Google for this Description, there should be many hits about how to use it)

You can use this DLL with Api calls to get a List of the SQL Servers.

and Last but not least a imho not so clean and reliable way:

the WINSOCK dll you can scan the Network for Machines with the SQL-Server Standard Ports. But keep in mind, that SQL not always uses these Ports, because they are changeable.

I hope one of this Ideas fits your needs.

greetz Dave


The SQL is not always installed there so I guess I will try the second option.

Thanks.