Author | Chrissy LeMaire (@cl), netnerds.net |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Add-DbaAgListener on GitHub.
Want to see the Bill Of Health for this command? Check out Add-DbaAgListener.
Adds a listener to an availability group on a SQL Server instance.
Adds a listener to an availability group on a SQL Server instance.
Add-DbaAgListener
[[-SqlInstance] <DbaInstanceParameter[]>]
[[-SqlCredential] <PSCredential>]
[[-AvailabilityGroup] <String[]>]
[[-Name] <String>]
[[-IPAddress] <IPAddress[]>]
[[-SubnetIP] <IPAddress[]>]
[[-SubnetMask] <IPAddress[]>]
[[-Port] <Int32>]
[-Dhcp]
[-Passthru]
[[-InputObject] <AvailabilityGroup[]>]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PS C:\> Add-DbaAgListener -SqlInstance sql2017 -AvailabilityGroup SharePoint -IPAddress 10.0.20.20
Creates a listener on 10.0.20.20 port 1433 for the SharePoint availability group on sql2017.
PS C:\> Get-DbaAvailabilityGroup -SqlInstance sql2017 -AvailabilityGroup availabilitygroup1 | Add-DbaAgListener -Dhcp
Creates a listener on port 1433 with a dynamic IP for the group1 availability group on sql2017.
PS C:\> Add-DbaAgListener -SqlInstance sql2017 -AvailabilityGroup SharePoint -IPAddress 10.0.20.20,10.1.77.77 -SubnetMask 255.255.252.0
Creates a multi-subnet listener with 10.0.20.20 and 10.1.77.77, on two /22 subnets, on port 1433 for the SharePoint availability group on sql2017.
The target SQL Server instance or instances. Server version must be SQL Server version 2012 or higher.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Login to the SqlInstance instance using alternative credentials. Windows and SQL Authentication supported. Accepts credential objects (Get-Credential)
Alias | |
Required | False |
Pipeline | false |
Default Value |
The Availability Group to which a listener will be bestowed upon.
Alias | |
Required | False |
Pipeline | false |
Default Value |
The name of the listener. If one is not specified, the Availability Group name will be used.
Note that Name cannot be used with Multiple Ags.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Sets the IP address(es) of the availability group listener.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Sets the Subnet IP address(es) of the availability group listener.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Sets the subnet IP mask(s) of the availability group listener. Defaults to 255.255.255.0.
Alias | |
Required | False |
Pipeline | false |
Default Value | 255.255.255.0 |
Sets the port number used to communicate with the availability group. Defaults to 1433.
Alias | |
Required | False |
Pipeline | false |
Default Value | 1433 |
Indicates whether the listener uses DHCP.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Don't create the listener, just pass thru an object that can be further customized before creation.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Enables piping from Get-DbaAvailabilityGroup
Alias | |
Required | False |
Pipeline | true (ByValue) |
Default Value |
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Shows what would happen if the command were to run. No actions are actually performed.
Alias | wi |
Required | False |
Pipeline | false |
Default Value |
Prompts you for confirmation before executing any changing operations within the command.
Alias | cf |
Required | False |
Pipeline | false |
Default Value |