Microsoft Virtualization Discussions

Bulk SM relationsship creation with Powershell ?

taner_sagcan
5,342 Views

Hi there!

Has anyone experience with creation of Snapmirror Relationsships in bulk, i talk about more than 50....

I think about to create a txt oder csv file where SourceVOL and DestVOL is entered and the cmdlet reads each row/column and create the relationship beetween the 2 Controllers.

Any ideas or sample script are welcome.

Thx

taner

1 ACCEPTED SOLUTION

vinith
5,343 Views

Hi Taner,

DataOntap Toolkit has a cmdlet called Invoke-NaSnapmirrorInitialize which helps in creation of snapmirror relationship between source controller volume and destination controller volume.

To Get detailed information about the cmdlet you can run

Get-Help Invoke-NaSnapmirrorInitialize -Detailed

In order to scriptize the snapmirror relationship you can try something like below, create a csv file with entries as below specifying the destination/source volume and controller name.

DestinationControllerDestinationVolumeNameSourceController SourceVolumeName
bensonbenvol1dunndunvol1
bensonbenvol2dunndunvol2
bensonbenvol3dunndunvol3
bensonbenvol4dunndunvol4
bensonbenvol5dunndunvol5
bensonbenvol6dunndunvol6
bensonbenvol7dunndunvol7
bensonbenvol8dunndunvol8
bensonbenvol9dunndunvol9
bensonbenvol10dunndunvol10
bensonbenvol11dunndunvol11
bensonbenvol12dunndunvol12
bensonbenvol13dunndunvol13

Then through your powershell prompt, import the csv and feed it to Invoke-NaSnapmirrorInitialize to iterate though the csv and create snapmirror relationships for each destination and source volume

PS C:\> $snapinfo = Import-Csv C:\Users\vinith\Desktop\snapinfo.csv

PS C:\> $snapinfo | ForEach-Object {Invoke-NaSnapmirrorInitialize '$_.destinationcontroller:$_.destinationvolumename' '$_.sourcecontroller:$_.sourcevolumename' }


View solution in original post

3 REPLIES 3

vinith
5,344 Views

Hi Taner,

DataOntap Toolkit has a cmdlet called Invoke-NaSnapmirrorInitialize which helps in creation of snapmirror relationship between source controller volume and destination controller volume.

To Get detailed information about the cmdlet you can run

Get-Help Invoke-NaSnapmirrorInitialize -Detailed

In order to scriptize the snapmirror relationship you can try something like below, create a csv file with entries as below specifying the destination/source volume and controller name.

DestinationControllerDestinationVolumeNameSourceController SourceVolumeName
bensonbenvol1dunndunvol1
bensonbenvol2dunndunvol2
bensonbenvol3dunndunvol3
bensonbenvol4dunndunvol4
bensonbenvol5dunndunvol5
bensonbenvol6dunndunvol6
bensonbenvol7dunndunvol7
bensonbenvol8dunndunvol8
bensonbenvol9dunndunvol9
bensonbenvol10dunndunvol10
bensonbenvol11dunndunvol11
bensonbenvol12dunndunvol12
bensonbenvol13dunndunvol13

Then through your powershell prompt, import the csv and feed it to Invoke-NaSnapmirrorInitialize to iterate though the csv and create snapmirror relationships for each destination and source volume

PS C:\> $snapinfo = Import-Csv C:\Users\vinith\Desktop\snapinfo.csv

PS C:\> $snapinfo | ForEach-Object {Invoke-NaSnapmirrorInitialize '$_.destinationcontroller:$_.destinationvolumename' '$_.sourcecontroller:$_.sourcevolumename' }


taner_sagcan
5,343 Views

HI Vinith!

Perfect and thank you ! thats what i Need!

br taner

rdenyer001
5,168 Views

Hi Vinith,

I am very new to Power Shell scripting  aand would like to know in your example  do the  destination  volume have to exist  for this  to work ?

If they do, what would the script look like to create the new destination volumes  ?

Regards,

Richard

Public