The transition to NetApp MS Azure AD B2C is complete. If you missed the pre-registration, you will be invited to reigister at next log in.
Please note that access to your NetApp data may take up to 1 hour.
To learn more, read the FAQ and watch the video.
Need assistance? Complete this form and select “Registration Issue” as the Feedback Category.

Microsoft Virtualization Discussions

powershell for snapmirror

NAIRSATISH

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

3 REPLIES 3

olson

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

NAIRSATISH

Hi olson,

i tried looking up those functions online but could not figure out how to use it.

with the script that i have where and how should i insert these funcations.

Thx

JOHNGARRETT

One thing you might try is to just look at your variable after the failure. I.e., enter $line.source and that'll show you the value of that variable the last time it was changed. You might find that there's an illegal character in your vol name, which could happen depending on how you generated the .csv to begin with.

Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public