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

Diskconsolidation send email as HTML is blank

$
0
0

Hello !

 

am trying to gathers list of vms in a vc and send an email as HTML, i see script is executing but when it is sending report is blank.

help me in correcting this.

 

# Get date in UK format day/month/year

$date = Get-Date -Format dd/MM/yy

 

$Header = @"

<style>

TABLE {border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}

TH {border-width: 1px;padding: 3px;border-style: solid;border-color: black;background-color: #6495ED;}

TD {border-width: 1px;padding: 3px;border-style: solid;border-color: black;}

</style>

"@

 

Connect-VIServer -Server vc -User -u admin -p admin

$Report = Get-VM | Where-Object {$_.Extensiondata.Runtime.ConsolidationNeeded} | Select Name, PowerState, UsedSpaceGB | ConvertTo-HTML -Head $Header

# Send email message

Send-mailmessage -to "xyz@abc.com" -from "zyx@abc.com" -subject "Disk consolidation needed" -body "Please find below vms requried disk consolidation , take necessary action." -BodyAsHtml -SmtpServer "10.1.2.3"

=============================

 

in email am receiving without data

 


Viewing all articles
Browse latest Browse all 175326

Trending Articles