I tried this with the send-mailmessage cmdlet:
$emailSmtpServer = "XY"
$emailfrom = "XY"
$emailto = "XY"
$emailSubject = "Hidden Snapshots Check"
$emailbody = foreach($vm in get-vm) { get-harddisk -vm $vm| select @{N="VMname";E={$vm.name}},Filename |? {$_.FileName.Split('/')[-1] -match ".*\-[0-9]{6}\.vmdk"} }
Send-MailMessage -To $emailTo -From $emailFrom -Subject $emailSubject -Body $emailBody -BodyAsHTML -SmtpServer $emailSmtpServer
unfortunately i get an error message: "Cannot convert 'system.Object' to the type 'system.string' required by parameter 'body'
do you know how to fix this?