dbatools is a free PowerShell module with over 300 SQL Server administration, best practice and migration commands included.

Please note that documentation and command names may be out of date while we work furiously towards 1.0


This function changes the TCP port used by the specified SQL Server.




Sets the port number 1433 for allips on the default instance on SqlInstance2014a.

Set-DbaTcpPort -SqlInstance SqlInstance2014a -Port 1433

Sets the port number 1433 for IP on the sqlexpress instance on winserver.

Set-DbaTcpPort -SqlInstance winserver\sqlexpress -IpAddress -Port 1433

Sets the port number 1337 for ALLIP’s on SqlInstance SQLDB2014A and SQLDB2016B.

Set-DbaTcpPort -SqlInstance ‘SQLDB2014A’ ,’SQLDB2016B’ -port 1337


This command was created by [email protected]


From PowerShell, execute Get-Help Set-DbaTcpPort -Detailed for more information on this function.

Source Code

Want to see the source code? View Set-DbaTcpPort.ps1 on GitHub

Related commands