Get Secondary replica name in a variable

  • SQLAddict01

    Say Hey Kid

    Points: 690

    I need to pass secondary replica name in a variable to a command

    for example

    I get the primary replica name using

    Get-DbaAvailabilityGroup -SqlInstance ListenerName| Select-Object * -ExpandProperty PrimaryReplicaServerName

    How do I get the secondary replica name?

     

    Thanks

  • Sue_H

    SSC Guru

    Points: 90700

    dbatools also has the cmdlet Get-DbaAgReplica that you may want to try.

    Sue

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply