3 Replies Latest reply: Sep 13, 2013 2:04 PM by JOHNGARRETT RSS

powershell for snapmirror

NAIRSATISH Certified Novice
Currently Being Moderated

hello!

i am new to powershell and am trying to write a scritp to snapmirror more than 50 volumes using snapmirror, source and destination volumes have been created .Destinations volumes have been restricted.

With some online help i have this scrit to snapmirror volumes but it fails can someone point out the right way to get this done.

Thx

$csv = Import-Csv C:\volume1.csv

$filer1 = "10.168.55.13"

$filer2 = "10.168.55.14"

foreach ($line in $csv) {

    Invoke-NaSnapmirrorInitialize -Source $filer1:$line.source -Destination $filer2:$line.dest

}

 

My csv file looks like this

 

 

i get the following error

Invoke-NaSnapmirrorInitialize : Invalid destination @{source=vol1; dest=vol1}.dest: invalid character found in the vol

At C:\Users\xyz\snapmirrortest.ps1:5 char:34

+     Invoke-NaSnapmirrorInitialize <<<<  -Source $filer1:$line.source -Destination $filer2:$line.dest

    + CategoryInfo          : InvalidOperation: (10.168.55.14:NaController) [Invoke-NaSnapmirrorInitialize], ESNAPMIRR

    + FullyQualifiedErrorId : ApiException,DataONTAP.PowerShell.SDK.Cmdlets.Snapmirror.InvokeNaSnapmirrorInitialize

 

Invoke-NaSnapmirrorInitialize : Invalid destination @{source=vol2; dest=vol2}.dest: invalid character found in the vol

At C:\Users\xyz\snapmirrortest.ps1:5 char:34

+     Invoke-NaSnapmirrorInitialize <<<<  -Source $filer1:$line.source -Destination $filer2:$line.dest

    + CategoryInfo          : InvalidOperation: (10.168.55.14:NaController) [Invoke-NaSnapmirrorInitialize], ESNAPMIRR

    + FullyQualifiedErrorId : ApiException,DataONTAP.PowerShell.SDK.Cmdlets.Snapmirror.InvokeNaSnapmirrorInitialize

  • Re: powershell for snapmirror
    olson NetApp Employee CertifiedPlus Sprinter
    Currently Being Moderated

    Greetings,

                  Usually when I run into issues like that it is due to a char at the end of the line in the csv file. you may want to look at the .trim() function to help with the problems. to diagnose if this is your issue you can use the .length() function to see how many chars are in your variables.

     

    Hope this helps

    John

More Like This

  • Retrieving data ...

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points