Examples/Resources/xSQLServerNetwork/1-EnableTcpIpWithStaticPort.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<#
.EXAMPLE
    This example will enable TCP/IP protocol and set the custom static port to 4509.
    When RestartService is set to $true the resource will also restart the SQL service.
#>

Configuration Example
{
    param
    (
        [Parameter(Mandatory = $true)]
        [System.Management.Automation.PSCredential]
        [System.Management.Automation.Credential()]
        $SysAdminAccount
    )

    Import-DscResource -ModuleName xSqlServer

    node localhost
    {
        xSQLServerNetwork 'ChangeTcpIpOnDefaultInstance'
        {
            InstanceName   = 'MSSQLSERVER'
            ProtocolName   = 'Tcp'
            IsEnabled      = $true
            TCPDynamicPort = $false
            TCPPort        = 4509
            RestartService = $true
        }
    }
}