Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
