use sql named instance in a powershell script

Hi

 

I am trying to use:

 

Set-SqlAvailabilityReplica -AvailabilityMode “SynchronousCommit” -FailoverMode “Manual” ` -Path “SQLSERVER:\SQL\xxx\DEFAULT\AvailabilityGroups\xxx\AvailabilityReplicas”

 

With an instance name meaning at the end sqlserver\instancename

 

Every attempt to put quotes, or encode the value or create a variable wont work

 

Anyone can help me find out how i can do this?

 

With a sql server no instance it works

 

Thanks

Take a look at this:

https://www.mikefal.net/2015/10/20/a-month-of-sqlps-managing-availability-group-replicas/

Note the path we use, not to be confused with the path of the SQL Server instance. This path should be within the context of the primary node for the AG. Running this command will create the replica.

[quote quote=251612]Take a look at this:

A Month of SQLPS: Managing Availability Group Replicas
<iframe width="600" height="264" class="wp-embedded-content" sandbox="allow-scripts" security="restricted" title="“A Month of SQLPS: Managing Availability Group Replicas” — Art of the DBA" src="https://www.mikefal.net/2015/10/20/a-month-of-sqlps-managing-availability-group-replicas/embed/#?secret=lPGncFHb4l" data-secret="lPGncFHb4l" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" data-mce-fragment="1"></iframe>
Note the path we use, not to be confused with the path of the SQL Server instance. This path should be within the context of the primary node for the AG. Running this command will create the replica.
[/quote]

Thanks. it guided me to the right place