Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 207710

Mail with Overview of VMs with Snapshots

$
0
0

Hi,

 

I've startet to script some basic things. The commands work fine, but I've trouble to get the output of the command a mailbody.

 

Here is my script:

 

Connect-VIServer -Server "vcentername" - Protocol https -User "username" - Password "userpassword"

$snap = Get-VM | Get-Snapshot | Select VM, SizeMB

$smtpServer = "mymailhost"

$smtpFrom = "sendermailadress"

$smtpTo = "recipientmailadress"

$messagesubject = "Snapoverview"

$messagebody = $snap

$smtp = new-object Net.Mail.SmtpClient($smtpServer)

$smtp.Send($smtpFrom, $smtpTo, $messagesubject, $messagebody)

 

I got a mail and the subject is correct but I don't have a body in the mail.

Any ideas?

 

Kind regards

 

Patrick


Viewing all articles
Browse latest Browse all 207710

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>