none
Disable dynamic Ports at Windows Server Core 2019 RRS feed

  • Question

  • Hi,

    have anyone an idea, how can i disable the dynamic port range at a core server? The manual describe this with the MS SQL Configuration Manager, but this don't run at the Core and can't connect from another host to the sql server?

    Core server is nice, but difficult ;-)

    Best regards,

    Stefan 

    Thursday, January 16, 2020 1:33 PM

All replies

  • Hi Stefan,

    Please try to use Power shell to disable dynamic Ports. Please refer to below blogs to get more information.
    10 PowerShell scripts to configure SQL Server.
    SQL Server 2012: Configuring your TCP Port via Powershell
    Set-SqlNetworkConfiguration
    Use PowerShell to set TCP Port for SQL to 1433

    If you meet some issue when using powershell, you ask help from Powershell forums, people there will help you effectively.

    Hope this could help you.

    Best regards,
    Cathy 


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to  MSDN Support, feel free to contact MSDNFSF@microsoft.com


    Friday, January 17, 2020 6:33 AM
  • Hi,

    thank's Cathy for your reply.

    Now i use this script:

    'Loading SQLPS environment'
    Import-Module SQLPS -DisableNameChecking -Force
    ($Wmi = New-Object ('Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer') $env:COMPUTERNAME)
    ($uri = "ManagedComputer[@Name='$env:COMPUTERNAME']/ ServerInstance[@Name='SQLEXPRESS']/ServerProtocol[@Name='Tcp']")
    ($Tcp = $wmi.GetSmoObject($uri))
    $wmi.GetSmoObject($uri + "/IPAddress[@Name='IPAll']").IPAddressProperties
    'Setting IP Properties'
    $wmi.GetSmoObject($uri + "/IPAddress[@Name='IPAll']").IPAddressProperties[1].Value="1433"
    'Review properties'
    $wmi.GetSmoObject($uri + "/IPAddress[@Name='IPAll']").IPAddressProperties
    
    'Save properties'
    $Tcp.Alter()
    
    'Review properties'
    $wmi.GetSmoObject($uri + "/IPAddress[@Name='IPAll']").IPAddressProperties

    I see at the output, that the dynamic port is active. But how can is deactivate this function?

    Review properties
    Name       : TcpDynamicPorts
    Value      : 50377
    Type       : System.String
    Writable   : True
    Readable   : True
    Expensive  : False
    Dirty      : False
    Retrieved  : True
    IsNull     : False
    Enabled    : False
    Required   : False
    Attributes : {}
    
    Name       : TcpPort
    Value      : 1433
    Type       : System.String
    Writable   : True
    Readable   : True
    Expensive  : False
    Dirty      : True
    Retrieved  : True
    IsNull     : False
    Enabled    : False
    Required   : False
    Attributes : {}
    

    A dynamic port is for a firewall terrible.

    Thank you and best regards,

    Stefan

    Friday, January 17, 2020 10:49 AM
  • Once the dynamic port is assigned, it never changes unless SQL Server detects the port is already in use during startup.  It is essentially a static port and can be treated as such for firewall purposes.
    Friday, January 17, 2020 4:04 PM