SMO Sample: Enable TCP/IP Server protocol of SQL Server 2005
Purpose of sample: Enable the TCP/IP server protocol.
This sample shows you how to change a server protocol setting. This sample assumes you have SQL Express installed. You need to change the instance name to match the instance name you have installed.
ManagedComputer mc = new ManagedComputer();
mc.ServerInstances[
"SQLEXPRESS"].ServerProtocols["Tcp"].IsEnabled = true;