Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
I need a code that programitically enables SQL Protocol such as (Tcp/Ip,Named Pipes,VIA) which can be found in SQL configuration Manager. Can anyone help me with a piece of code snippet.

Possible Answer[^]

above is a link i found while searching on the internet but do not know what to fill in instance name and server name


Thanks in advance
Posted

1 solution

You could try changing the registry value at HKLM\Software\Microsoft\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQLServer\SuperSocketNetLib. The server name might vary.

Alternately, you could use WMI - System.Management Namespace[^].
Here is an example - Configure Aliases Programmatically Using WMI[^].

You can do this though a powerscript that can be launched from C# - Enable or Disable a Server Network Protocol[^].
 
Share this answer
 
Comments
agent_kruger 2-Jul-15 5:49am    
sir, i have already gone through that but when i looked up in the registry i cannt find "HKLM\Software\Microsoft\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER" this last node i mentioned.
agent_kruger 2-Jul-15 5:52am    
and same problem with your other links "Configure Aliases Programmatically Using WMI". i cannot understand the paramters.

And your last method tells a way to connect without changing settings but in my case it is not possible as it needs every configuration enabled.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900