Hi
I hope someone can assist me please. I am now strugling for a few days to get a script to work. What I need to do is to create manual monthly snapshots, on all of the NetApp controllers in our environment, on all production volumes. This snapshots will then be mirrored to DR.
I have done the following:
set executionpolicy remotesigned
Import-Module DataONTAP
#Get Current Date and Save in the format YYYY_MM_DD
$Date = Get-Date -UFormat "%Y_%m_%d"
$Date
#Set SnapShot Name
$SnapName = "monthly_backup_$Date"
$SnapName
#Connect to Filers and create SnapShot
$filers = (Get-Content C:\Users\xxxxxxxxxx\Documents\filer_IP_list_toets.txt)
Foreach ($filer in $filers)
{
Connect-NAController $filer -Credential root
Get-NaVol $volName | New-NaSnapshot $SnapName
}
The output returns the following up to $SnapName
set executionpolicy remotesigned
Import-Module DataONTAP
#Get Current Date and Save in the format YYYY_MM_DD
$Date = Get-Date -UFormat "%Y_%m_%d"
$Date
#Set SnapShot Name
$SnapName = "monthly_backup_$Date"
$SnapName
#Connect to Filers and create SnapShot
$filers = (Get-Content C:\Users\xxxxxxxxxx\Documents\filer_IP_list_toets.txt)
Foreach ($filer in $filers)
{
Connect-NAController $filer -Credential root
Get-NaVol $volName | New-NaSnapshot $SnapName
}
2018_10_03 ($Date)
monthly_backup_2018_10_03 ($SnapName)
Then it asks for authentication:
return the following output:
Name Address Ontapi Version
---- ------- ------ -------
xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx 1.21 NetApp Release 8.2.3 P2 7-Mode: Wed Mar 4 19:06:11 PST 2015
New-NaSnapshot : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.
At line:20 char:22
+ Get-NaVol $volName | New-NaSnapshot $SnapName
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (CZ1029_vol0:PSObject) [New-NaSnapshot], ParameterBindingException
+ FullyQualifiedErrorId : InputObjectNotBound,DataONTAP.PowerShell.SDK.Cmdlets.Snapshot.NewNaSnapshot
It seems that the string cannot accet a pipe command?
Any ideas how I can get this working? I suppose it is something small that I am overlooking.
Regards