Hi, Adam. The Data ONTAP PowerShell Toolkit doesn't contain a cmdlet "connect-naserver" or a type "NetApp.SDK.NaVolume", so I'm not sure what you're using. Whatever that is, it appears the NetApp.SDK.NaVolume class doesn't override ToString(); the equivalent class emitted by the Toolkit does. Can you try with the Toolkit and let us know how that works?
I had a friend help me take a look at this and we found out that I had dataontap and poshontap modules loaded. I have unloaded poshontap, which must have had a replacement Connect-NaController because my connection is persistent now. Data is being gathered just as before, but I'm still experiencing the issue where console output and the e-mail body are not the same.
Name State TotalSize Used Available Dedupe FilesUsed FilesTotal Aggregate
OK, Adam, that's progress. You should have no further need for PoshOntap; the Toolkit has superseded that project and its author joined NetApp some time ago.
Your issue is that Get-NaVol writes objects to the pipeline, which are displayed in tabular format by default by the shell. But you are sending the array of volume objects directly to the email. To preserve the volume formatting as a string, try something like "$vols = Get-NaVol | Out-String".
Awesome, adding "| Out-String" was the ticket. It's nothing fancy obviously but here's the complete script. It's handy for me so it might be handy for someone else. Thanks a million for the help Clinton, this will save me a solid 45-60 minutes per day. If you're ever in the Cincinnati area let me know, I owe you a few beers.
# Provide controller hostnames, IP's or FQDN's. Add/remove additional as needed.