Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL SERVER 2016 - Properties TCP / IP - Open IPALL TCPPort 1433

Status
Not open for further replies.

javieret

Programmer
Nov 23, 2017
1
0
0
ES
Sin_t%C3%ADtulo_zbkyhf.png


An issue that is driving me crazy for a week

I need to open 1433 without outside help from users

For this I have tried the following 1º Access the registry key and modify it from vb.net, Framework 4.0 Visual Studio 2010, but the key does not allow to modify it HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL13.MSSQLSERVERMSSQLServer\SuperSocketNetLib\Tcp\IPAll

2nd Launch a .bat that launches a vb.script Contents of .bat @echo off if %1==payload goto :payload

:getadmin echo %~nx0: elevating self set vbs=%temp%\getadmin.vbs echo Set UAC = CreateObject^(“Shell.Application”^) >> "%vbs%“ echo UAC.ShellExecute “%~s0”, “payload %~sdp0 %*”, “”, “runas”, 1 >> “%vbs%” ”%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" goto :eof

:payload

::ENTER YOUR CODE BELOW::

cd
cd C:\Program Files (x86)\MiCarpeta dir pause

start 1433_SQL2016.vbs

pause

::END OF YOUR CODE::

echo. echo…Script Complete… echo.

pause

Contents of a vbscript gist.github.com
configIPAll.vbs

set wmiComputer = GetObject( _ "winmgmts:" _ & "\.\root\Microsoft\SqlServer\ComputerManagement12") set tcpProperties = wmiComputer.ExecQuery( _ "select * from ServerNetworkProtocolProperty " _ & "where InstanceName='MSSQLSERVER' and " _ & "ProtocolName='Tcp' and IPAddressName='IPAll'")

for each tcpProperty in tcpProperties dim setValueResult, requestedValue This file has been truncated. show original set wmiComputer = GetObject( _ “winmgmts:” _ & “!.\root\Microsoft\SqlServer\ComputerManagement13”)

set tcpProperties = wmiComputer.ExecQuery( _ "select * from ServerNetworkProtocolProperty " _ & "where InstanceName='MSSQLSERVER' and " _ & "ProtocolName='Tcp' and IPAddressName='IPAll'")

for each tcpProperty in tcpProperties

dim setValueResult, requestedValue
Wscript.Echo tcpProperty.PropertyName
if tcpProperty.PropertyName = "TcpPort" then
requestedValue = "1433"
elseif tcpProperty.PropertyName ="TcpDynamicPorts" then
requestedValue = ""
end if
setValueResult = tcpProperty.SetStringValue(requestedValue)
if setValueResult = 0 then
Wscript.Echo "" & tcpProperty.PropertyName & " set."
else
Wscript.Echo "" & tcpProperty.PropertyName & " failed!"
end if
next If I launch this .bat from a double click with mouse help, it executes and changes the port to 1433 However, if the .bat is thrown from a process.start + admin permissions “runas” does not find image

Sin_t%C3%ADtulo2_ergkre.png



3rd

I have also tried with the query to try changing the registry key of windows but nothing DECLARE @portNumber NVARCHAR(10)=1433

EXEC xp_instance_regread @rootkey = ‘HKEY_LOCAL_MACHINE’, @key = ‘SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQLServer\SuperSocketNetLib\Tcp\IPAll’, @value_name = ‘TcpPort’, @value = @portNumber OUTPUT

SELECT [Port Number] = @portNumber GO

Someone in myself situation ??? Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top