All,
Very new to scripting/powershell and have a task to move many viloumes from and old 7-mode filer 7.3.6 to a new filer 7 mode 8.2.2 (unfortunealty can't go cDOT)
Trying to write a script that will allow me to put in the name of the volume on the old system and its size and then have the script create the volume on the new system and then complete the snap mirror initialize.
Here is my script ( made up of parts copied from various scripts found on the web)
## Controller Login Variables
Import-Module dataontap
$ntapuser = "XXXX"
$ntappw = "XXXX"
### Convert Password to plain text
$pw = convertto-securestring $ntappw -asplaintext -force
$cred = new-object -typename system.management.automation.pscredential -argumentlist $ntapuser,$pw
# Connect to Snapmirror Source and Destination
$SrcFiler = Connect-NaController XXXX -Credential $cred -https
$DestFiler = Connect-NaController XXXX -Credential $cred -https
#set volume name and size
$Vol = Read-Host 'Volume Name?'
$Size = Read-Host 'Volume Size?'
$Scr = $SrcFiler + ":" + $Vol
I get this error Method invocation failed because [NetApp.Ontapi.Filer.NaController] doesn't contain a method named 'op_Addition
$Dest = $DestFiler + ":" + $Vol
and here
# Create our destination volume
New-NaVol $Vol -Controller $DestFiler -Aggregate aggr0 -Size $Size -SpaceReserve none
I get this error here New-NaVol : Object reference not set to an instance of an object.
At C:\Users\Richard\NewMirror2.ps1:18 char:1 + New-NaVol $Vol -Controller $DestFiler -Aggregate aggr0 -Size $Size -SpaceReserve
But the volume is created
Set-NaVol -Name $Vol -Restricted -Controller $DestFiler
Same here Set-NaVol : Object reference not set to an instance of an object.
At C:\Users\Richard\NewMirror2.ps1:19 char:1 + Set-NaVol -Name $Vol -Restricted -Controller $DestFiler
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
but the volume is restricted
# Initialize Snapmirror
Invoke-NaSnapmirrorInitialize -Destination $Dest -Source $Scr
But then here, this just fails but I figure that is more related to the first error at line 15 and 16
I have downloaed and installed latest toolkit
have noticed that results coming back from the new 8.2.2 system (destination) are a LOT slower than the old 7.3.6 system
Any help and or suggestions would be greatly appriciated .
Here is the total out put from my powershell session
PS C:\Users\Richard> .\NewMirror2
Volume Name?: TestVOL
Volume Size?: 40g
Method invocation failed because [NetApp.Ontapi.Filer.NaController] doesn't contain a method named 'op_Addition'.
At C:\Users\Richard\NewMirror2.ps1:15 char:1
+ $Scr = $SrcFiler + ":" + $Vol
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (op_Addition:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
Method invocation failed because [NetApp.Ontapi.Filer.NaController] doesn't contain a method named 'op_Addition'.
At C:\Users\Richard\NewMirror2.ps1:16 char:1
+ $Dest = $DestFiler + ":" + $Vol
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (op_Addition:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
New-NaVol : Object reference not set to an instance of an object.
At C:\Users\Richard\NewMirror2.ps1:18 char:1
+ New-NaVol $Vol -Controller $DestFiler -Aggregate aggr0 -Size $Size -SpaceReserve ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (DC-XXX:NaController) [New-NaVol], NullReferenceException
+ FullyQualifiedErrorId : VolumeListInfoFailed,DataONTAP.PowerShell.SDK.Cmdlets.Volume.NewNaVol
Set-NaVol : Object reference not set to an instance of an object.
At C:\Users\Richard\NewMirror2.ps1:19 char:1
+ Set-NaVol -Name $Vol -Restricted -Controller $DestFiler
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (DC-XXX:NaController) [Set-NaVol], NullReferenceException
+ FullyQualifiedErrorId : VolumeListInfoFailed,DataONTAP.PowerShell.SDK.Cmdlets.Volume.SetNaVol
Invoke-NaSnapmirrorInitialize : Cannot bind argument to parameter 'Destination' because it is null.
At C:\Users\Richard\NewMirror2.ps1:22 char:45
+ Invoke-NaSnapmirrorInitialize -Destination $Dest -Source $Scr
+ ~~~~~
+ CategoryInfo : InvalidData: (:) [Invoke-NaSnapmirrorInitialize], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,DataONTAP.PowerShell.SDK.Cmdlets.Snapmirr
or.InvokeNaSnapmirrorInitialize
Regards,
Richard