Microsoft Virtualization Discussions

Snapmirror break script

SAULBADGUY
4,270 Views

Hello all -

We are working on using Snapmirror to facilitate a multi-site windows failover cluster. We are running in to one small issue though - when we invoke the snapmirror break command, it asks us to confirm that we "really" want to do this. This sort of takes the "automatic" part out of it...

Here is the script:

#import netapp module

Import-Module dataONTAP;

[string]$sqlInstance = 'SQLCluster'

#connect to the controller managing the volumes for this SQL instance.

Connect-NaController Filer01 #| Out-Null

$mirrors = Get-NaSnapmirror

foreach($mirror in $mirrors)

{

    if($mirror.source -match "Filer02:")

    {

            write-host $mirror.Source $mirror.destination

            Invoke-NaSnapmirrorBreak $mirror.Destination Y #$mirror.Source     --confirm switch? 

    }    

}

"Are you sure you want to start SnapMirror break to filer02:volume01?"

[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):

1 REPLY 1

JGPSHNTAP
4,270 Views

So, I see why are you doing it with a for loop.. Is that b/c you want to see your write-host?

did you try -confirm:$False

Public