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.
Examples
Example 1: Modify a listener for an availability group
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
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.
Parameters
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type:
SwitchParameter
Default value:
False
Supports wildcards:
False
DontShow:
False
Aliases:
cf
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-InputObject
Specifies the listener, as an AvailabilityGroupListener object, that this cmdlet modifies.
Parameter properties
Type:
AvailabilityGroupListener
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
ByObject
Position:
2
Mandatory:
True
Value from pipeline:
True
Value from pipeline by property name:
False
Value from remaining arguments:
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.
Parameter properties
Type:
String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
ByPath
Position:
2
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-Port
Specifies the port on which the listener listens for connections.
The default port is TCP port 1433.
Parameter properties
Type:
Int32
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-Script
Indicates that this cmdlet returns a Transact-SQL script that performs the task that this cmdlet performs.
Parameter properties
Type:
SwitchParameter
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
Parameter properties
Type:
SwitchParameter
Default value:
False
Supports wildcards:
False
DontShow:
False
Aliases:
wi
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
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.