Enabling tcp/ip via script??

  • Enabling tcp/ip port can be done using SQL Server configuration manager. Is there a way to enable TCP/IP via script??

    thanks in advance

  • I take it you're referring to the TCP port on which SQL Server listens?  This information is stored in the registry, so you can use the reg add utility to change the port to whatever you like.

    Note I'm only saying you can do this - not that I necessarily think it's a good idea.  The usual caveats about editing the registry directly apply, and you will want to think about how you are going to stop anyone getting hold of your script and maliciously or accidentally changing your port number.

    Don't forget to restart the SQL Server service to make the change take effect.

    John

  • There's the property TcpFlag of the Registry2 object in DMO.

    Use i.e. a WSH script to set the value { True | False }, and remember to restart the SQL Server service - like John said.

    This can also be done by DMO with the methods Stop and Start of the SQLServer object.

    /Niels Grove-Rasmussen

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply