Microsoft Virtualization Discussions

script to restrict and initialize snapmirror

JSHACHER11
3,049 Views

I am trying to create a script to restrict and initialize snapmirror - it is only for learning purpose so I am only using one filer

The relationships should be

vol1 -> vol3

vol2 -> vol4

I was trying this, but got lost:

(Set-NaVol -Restricted is asking for volume name)

+++++++++++++++++++++++++++++++

Import-Module dataontap

$filer = Read-Host "Enter the filer name"

$user = Read-Host "Enter the username"

Connect-NaController $filer -Credential $user

$source1 = vol1

$source2 = vol2

$dest1 = vol3

$dest2 = vol4

$dests = ($dest1,$dest2)

$sources = ($source1,$source2)

foreach ($dest in $dests)

{

Set-NaVol -Restricted

}

Invoke-NaSnapmirrorInitialize $dest1 $source1

Invoke-NaSnapmirrorInitialize $dest2 $source2

++++++++++++++++++++++++++++++++++

how is that done right?

Cheers

1 ACCEPTED SOLUTION

JSHACHER11
3,049 Views

Got it!

++++++++++++++++++++++++++++

Import-Module dataontap

$filer = Read-Host "Enter the filer name"

$user = Read-Host "Enter the username"

Connect-NaController $filer -Credential $user

$source1 = Get-NaVol vol1

$source2 = Get-NaVol vol2

$dest1 = Get-NaVol vol3

$dest2 = Get-NaVol vol4

$dests = $dest1,$dest2

$sources = $source1,$source2

foreach ($dest in $dests) {Set-NaVol -Name $dest -Restricted}

Invoke-NaSnapmirrorInitialize $dest1 $source1
Invoke-NaSnapmirrorInitialize $dest2 $source2

Get-NaSnapmirror | select Status,BaseSnapshot,LagTimeTS

++++++++++++++++++++++

View solution in original post

1 REPLY 1

JSHACHER11
3,050 Views

Got it!

++++++++++++++++++++++++++++

Import-Module dataontap

$filer = Read-Host "Enter the filer name"

$user = Read-Host "Enter the username"

Connect-NaController $filer -Credential $user

$source1 = Get-NaVol vol1

$source2 = Get-NaVol vol2

$dest1 = Get-NaVol vol3

$dest2 = Get-NaVol vol4

$dests = $dest1,$dest2

$sources = $source1,$source2

foreach ($dest in $dests) {Set-NaVol -Name $dest -Restricted}

Invoke-NaSnapmirrorInitialize $dest1 $source1
Invoke-NaSnapmirrorInitialize $dest2 $source2

Get-NaSnapmirror | select Status,BaseSnapshot,LagTimeTS

++++++++++++++++++++++

Public