I can think of these ways:
1- checking services with servicecontroller class: Not promising as you dont know the instance name on target machine
2- Enumerating services and check for any service that starts with MSSQLSERVER
3- Trying to connect to it. but to what database? master database? Can someone remove master database from the sql server? still no good cause it takes a long time for an exception to be thrown in case it can not connect.
4- Connecting to the specific port of SQL server. No good cause you may run sql server on another port or another serivce listens on that port
For local server second way seems good and for remote server the third way.
Whats your idea?


Reply With Quote