Hey Seffy,
Can you try this
save the below to a .ps1 file, make sure that you enter your controller names in filernames.txt, the current script asks the user for credentials everytime it reads a new controller name in filernames.txt
$filerlist = Get-Content "c:\filernames.txt"
$volinfoarraysnap=@()
foreach ($filer in $filerlist)
{
Connect-NaController -Name $filer -Credential (Get-credential)
$voldetails = Get-NaVol
foreach ($vol in $voldetails)
{
$snapshotdetails = Get-Nasnapshot -TargetName $vol | Sort-Object -Descending created | select -First 1
$volinformation = New-Object -TypeName psobject -Property @{
'VolumeName' = $vol.Name;
'VolumeLatestSnapshotName' = $snapshotdetails.Name;
'VolumeLatestSnapshotCreatedDate' = $snapshotdetails.created;
'VolumeLatestSnapshotTotal(MB)' = ($snapshotdetails.Total)/1mb
'VolumeLatestSnapshotCumulative(MB)' = ($snapshotdetails.CumulativeTotal)/1mb
}
$volinformation
$volinfoarraysnap += $volinformation
}
}
$volinfoarraysnap | Export-Csv "c:\volsnapinfo.csv"
If you have a same user name and password for all your controllers you can use the below scriptlet in your code.
$ControllerPassword = ConvertTo-SecureString -String 'netapp1!' -AsPlainText -force
$credential = New-Object System.Management.Automation.PsCredential("vsadmin",$ControllerPassword)
$test = Connect-NaController -Name $control -Credential $credential