Click here to Skip to main content
15,892,005 members

Comments by RickiB (Top 4 by date)

RickiB 20-Aug-13 18:50pm View    
Tiaan,
You all right. Yeah, I agree with you about using the registry. It's just not reliable. I found 2 other ways to get it. ServiceController and WMI
Thank You for your help!
RickiB 20-Aug-13 15:40pm View    
Tiaan,
Thanks for your reply. I also tried EnumSqlServersAvailable which I should have mentioned. I commented out the code with the reasons I didn't use it. It is also dependent on the "SQL Server Browser" service to be running. The section below is from MS EnumSqlServerAvailable description:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The computer that is running the instance SQL Server might not receive responses to the EnumAvailableSqlServers method in a timely manner. The returned list might not show all the available instances of SQL Server on the network. When you call the EnumAvailableSqlServers method in subsequent tries, more servers might become visible on the network.

This method fails to list the local instance if a firewall is operating on the server. The firewall blocks any broadcast traffic issued when the method is called, even if the sender is from local machine.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This still doesn't help with tying the Server Instance with Services. I also tried using MSSQL$.contains, which only works on Express releases, but the MSSQLEXPRESS service isn't showing up when I extract the Services even though it's running. I chose to use ManagedComputer because it looked like the best option to tie the Instance to the Service.
Thanks,
Rick
RickiB 3-Jan-13 18:54pm View    
Thanks rahkan, that's the ticket! I still must be in vacation mode...
RickiB 21-Dec-12 16:51pm View    
Christian, Thanks for your reply. You're right. Even if I disconnect in Management Studio, it still doesn't log out even after closing Management Studio; I still need to restart the SQL Server Services before starting the VS app. And I couldn't find a log out or disconnect in sqlcmd either without sp_detach_db which causes additional problems.
Thanks again,
Rick