Link to home
Start Free TrialLog in
Avatar of Zolf
ZolfFlag for United Arab Emirates

asked on

Enabling TCP/IP/ protocol in sql server configuration manager using CMD

Hello there,,

How can I  ENABLE TCP/IP protocol in sql server configuration manager using COMMAND PROMPT ?. I am using SQL server 2008.

cheers
Zolf
Avatar of Mandeep Singh
Mandeep Singh
Flag of India image

Hi,

you can do it by powershell.

try this link http://msdn.microsoft.com/en-us/library/ms191294.aspx
Avatar of Zolf

ASKER

this is not working for me. i get below error.....cannot i use simple cmd.

PS C:\Users\zaj> Import-Module "sqlps"
Import-Module : The specified module 'sqlps' was not loaded because no valid module file was found in any module direct
ory.
At line:1 char:14
+ Import-Module <<<<  "sqlps"
    + CategoryInfo          : ResourceUnavailable: (sqlps:String) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

I tried something like this in my cmd prompt. But it is not enabling the TCP when i check in sql server configuration manager

C:\Users\zaj>WMIC /NAMESPACE:\\root\Microsoft\SqlServer\ComputerManagement10 PATH ClientNetwork
Protocol WHERE ProtocolName='Tcp' CALL SetEnable
Executing (\\ZAJ-VAIO\root\Microsoft\SqlServer\ComputerManagement10:ClientNetworkProtocol.Proto
colName="tcp")->SetEnable()
Method execution successful.
Out Parameters:
instance of __PARAMETERS
{
        ReturnValue = 0;
};

Open in new window

SOLUTION
Avatar of Mandeep Singh
Mandeep Singh
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Zolf

ASKER

thanks for your help...but i get this error. I am copying the script as mentioned in that link

C:\>WMIC /NAMESPACE:\\root\Microsoft\SqlServer\ComputerManagement10 PATH ServerNetworkProtocol
Where ProtocolName='Tcp' CALL SetEnable
ERROR:
Description = Invalid query

Open in new window

Avatar of Zolf

ASKER

it seems it is those quotes surrounding TCP which waS GIVING THAT ERROR. By the way something is going on here and that is I disable my tcp from the sql server configuration manager and then using the cmd i am testing to see if it enables it but it seems it is not enabling. what is wrong or what am i missing or doing wrong.
The query works fine perfectly fine on my system, may be it's a error on your sql server. Do you installed Sql Server on your system or just client.
Avatar of Zolf

ASKER

i have installed server 2008..weird!! via sql server configuration manager it works but not via cmd script
it's a default instance or named instance.

if it is a named instance then use it like this:

WMIC /NAMESPACE:\\root\Microsoft\SqlServer\ComputerManagement10\instance_name
Avatar of Zolf

ASKER

no its default instance
Remove 10 after ComputerManagement10 from this and then give a try.
Avatar of Zolf

ASKER

i get this error when i remove that 10

C:\>WMIC /NAMESPACE:\\root\Microsoft\SqlServer\ComputerManagement PATH ServerNetworkProtocol Wh
ere ProtocolName='Tcp' CALL SetEnable
ERROR:
Description = Invalid namespace
Avatar of Zolf

ASKER

here is a screen shot to make it more clear to my problem

User generated image
After you run this script in command prompt, just do a refresh on SQL Server Configuration manager.

or Close SQL Server configuration manager and then open it.

because it does not refresh by itself.
Avatar of Zolf

ASKER

the same issue i have with enable. that is i disable the tcp/ip from the configuration manager and then via the cmd i run the script to enable, it runs the script but when i check the manager it is not disabled
Avatar of Zolf

ASKER

After you run this script in command prompt, just do a refresh on SQL Server Configuration manager.

I tried to refresh and also close and start the mssql instance but no luck
i do not know what happening on your end but as seen in your screenshot query works fine.

i am working on same query and works perfectly fine with me.
Avatar of Zolf

ASKER

yes the query is running but it is not applying those changes to the sql server. could it be that this script is doing this action on another sql server...as far as i know i just have one sql server instace which is called MSSQLSERVER
Avatar of Zolf

ASKER

can we explicitly tell the script to get this instance of mssql and apply the changes...to be sure
this script is doing changes on default instance by default that is MSSQLSERVER
Avatar of Zolf

ASKER

i dont know why it is not working for me via the CMD script method
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Zolf

ASKER

OK, using this script also it i snot working.do you get the same output when you run the ServerNetworkProtocol. the reason is when i run the client i get the script output different compared to the server version.as you can see below the output when i run using the ServerNetworkProtocol

C:\>WMIC /NAMESPACE:\\root\Microsoft\SqlServer\ComputerManagement10 PATH ServerNetworkProtocol
Where ProtocolName='Tcp' CALL SetDisable
Executing (\\ZAJ-VAIO\root\Microsoft\SqlServer\ComputerManagement10:ServerNetworkProtocol.Insta
nceName="MSSQLSERVER",ProtocolName="Tcp")->SetDisable()
Method execution successful.

Open in new window

yes i got same result on execution, and my services are disabled and enabled by this script.
Avatar of Zolf

ASKER

dont know what I am missing...frustrating...anyway thanks for your help!!
Avatar of Zolf

ASKER

i will wait for a day if i dont get any solution i will except your answer
SOLUTION
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Zolf

ASKER

I did that,but still the changes are not reflected.weird