Set-SqlAvailabilityReplica command is returning 'Cannot find path....' error

  • Hi there
    I'm building up some PowerShell scripts to use for AlwaysOn failovers, etc. At the moment I am struggling with the Set-SqlAvailabilityReplica command. I need to use this to set my AG replica to synchronous commit mode, using the following command:

    Set-SqlAvailabilityReplica -AvailabilityMode "SynchronousCommit" -FailoverMode "Manual" -Path "SQLSERVER:\Sql\MyServer1\MyInstance\AvailabilityGroups\MyAG\AvailabilityReplicas\MyServer2\MyInstance"

    But I get :

    Set-SqlAvailabilityReplica : Cannot find path 'SQLSERVER:\Sql\MyServer1\MyInstance\AvailabilityGroups\MyAG\AvailabilityReplicas\MyServer2\MyInstance' because it does not exist.

    Any ideas??? Judging from BOL and other blogs etc, this syntax should work!

    Thanks
    Doodles

  • doodlingdba - Friday, November 10, 2017 2:53 AM

    Hi there
    I'm building up some PowerShell scripts to use for AlwaysOn failovers, etc. At the moment I am struggling with the Set-SqlAvailabilityReplica command. I need to use this to set my AG replica to synchronous commit mode, using the following command:

    Set-SqlAvailabilityReplica -AvailabilityMode "SynchronousCommit" -FailoverMode "Manual" -Path "SQLSERVER:\Sql\MyServer1\MyInstance\AvailabilityGroups\MyAG\AvailabilityReplicas\MyServer2\MyInstance"

    But I get :

    Set-SqlAvailabilityReplica : Cannot find path 'SQLSERVER:\Sql\MyServer1\MyInstance\AvailabilityGroups\MyAG\AvailabilityReplicas\MyServer2\MyInstance' because it does not exist.

    Any ideas??? Judging from BOL and other blogs etc, this syntax should work!

    Thanks
    Doodles

    Did you import one of the SQL Server Powershell modules? SQLServer or SQLPS? That would be the more likely reason for the path not being recognized.
    If you execute: Get-PSDrive
     SQLServer would be one of the listed drives. If it's not listed, execute: Import-Module -name SQLServer

    Sue

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

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