Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 230200

Re: Run PowerCLI Script everyday and send output to mail

$
0
0

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?


Viewing all articles
Browse latest Browse all 230200

Trending Articles



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