Set-SqlAvailabilityGroupListener

Sets the port setting on an availability group listener.

语法

ByPath (默认值)

Set-SqlAvailabilityGroupListener
    [[-Path] <String>]
    [-Port <Int32>]
    [-Script]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByObject

Set-SqlAvailabilityGroupListener
    [-InputObject] <AvailabilityGroupListener>
    [-Port <Int32>]
    [-Script]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

说明

The Set-SqlAvailabilityGroupListener cmdlet modifies the port setting on an existing availability group listener. Run this cmdlet on the server instance that hosts the primary replica.

示例

Example 1: Modify a listener for an availability group

PS C:\> Set-SqlAvailabilityGroupListener -Port 1535 -Path "SQLSERVER:\Sql\PrimaryServer\InstanceName\AvailabilityGroups\MainAG\AvailabilityGroupListeners\MainListener"

This command sets the port number for the availability group listener named MainListener to be 1535. This port is used to listen for connections to the listener.

Example 2: Create a script that modifies a listener

PS C:\> Set-SqlAvailabilityGroupListener -Port 1535 -Script -Path "SQLSERVER:\Sql\PrimaryServer\InstanceName\AvailabilityGroups\MainAG\AvailabilityGroupListeners\MainListener"

This command generates the Transact-SQL script that sets the port number for the availability group listener named MainListener to 1535. This command does not make that change.

参数

-Confirm

Prompts you for confirmation before running the cmdlet.

参数属性

类型:SwitchParameter
默认值:False
支持通配符:False
不显示:False
别名:cf

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-InputObject

Specifies the listener, as an AvailabilityGroupListener object, that this cmdlet modifies.

参数属性

类型:AvailabilityGroupListener
默认值:None
支持通配符:False
不显示:False

参数集

ByObject
Position:2
必需:True
来自管道的值:True
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Path

Specifies the path of the availability group listener that this cmdlet modifies. If you do not specify this parameter, this cmdlet uses current working location.

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

ByPath
Position:2
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Port

Specifies the port on which the listener listens for connections. The default port is TCP port 1433.

参数属性

类型:Int32
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Script

Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

参数属性

类型:SwitchParameter
默认值:False
支持通配符:False
不显示:False
别名:wi

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

输入

Microsoft.SqlServer.Management.Smo.AvailabilityGroupListener