Quantcast
Channel: All Data Protection posts
Viewing all articles
Browse latest Browse all 3480

Re: SnapDrive snapshots with snapmirror label

$
0
0

Not sure if this will help a script i did years ago where before there was snapmirror integration in SME i highlighted the command in orange i was running to add the label

 

###########################################################################
### IMPORT NETAPP DATAONTAP TOOLKIT

if((Get-Module -Name "DataOntap") -eq $Null){
Import-Module -Name DataONTAP
Write-Host "Module DataONTAP imported"
}

 

###########################################################################
### CONNECT TO Cluster vserver

### add password to file location can be whatever you want
$username = "vsadmin"
$password = convertto-securestring "netapp1" -AsPlainText -force
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
$Controller = "10.10.10.178"

Connect-NcController -Name $Controller -Credential $cred -HTTPS -Vserver sonetapp7

###########################################################################
### PREDEFINED SNAPMIRROR LABEL

$SnapmirrorLabel = "EXCH_DAILY"


###########################################################################
### GET VOLUME LIST EXCHANGE VOLUMES

$EXCH_Volumes = Get-NcVol | Where-Object {$_.Name -like "soexch*"}

for($i = 0;$i -lt $EXCH_Volumes.Length; $i++){

$UpdateSnapVault = $False
$VolumeSnapshot = Get-NcSnapshot -Volume $EXCH_Volumes[$i].Name | Where-Object {$_.Name -like "exchsnap*"} | sort descending

if(($VolumeSnapshot[0].Name -like "exchsnap*") -and ($VolumeSnapshot[0].SnapmirrorLabel -eq $Null) ){


$UpdateSnapVault = $True

Set-NcSnapshot -Vserver $EXCH_Volumes[$i].Vserver -Volume $EXCH_Volumes[$i].Name -Snapshot $VolumeSnapshot[0].Name -SnapmirrorLabel $SnapmirrorLabel

if($UpdateSnapVault -eq $True){

$SnapmirrorRelation = $Null
$SnapmirrorRelation = Get-NcSnapmirror -SourceVolume $EXCH_Volumes[$i].Name
Invoke-NcSnapmirrorUpdate -Source $SnapmirrorRelation.SourceLocation -Destination $SnapmirrorRelation.DestinationLocation

}

}

}

 


Viewing all articles
Browse latest Browse all 3480

Trending Articles