VMware Cloud Community
virtualdive
VMware Employee
VMware Employee

Hostmonitoring - Powercli

Hi All,

Need help to get the output of the below code formated in the HTML or CSS format and send it through email please. Also I wanted to the server 'Uptime' to this code please.

Get-Datacenter | Sort | Get-VMHost | Sort | Get-View |`
Select Name, ConnectionState, PowerState, OverallStatus, `
@{N="CPU Usage (GHz)";E={[math]::round(
$_.Summary.QuickStats.OverallCpuUsage/1024,2)}}, `
@{N="Memory Usage (GB)";E={[math]::round(
$_.Summary.QuickStats.OverallMemoryUsage/1024,2)}}

thanks

Regards,

'V'
thevshish.blogspot.in
vExpert-2014-2021
Reply
0 Kudos
1 Reply
Sfet
Contributor
Contributor

Not sure about the HTML bit I think I seen something before, it might have been a function that you passed in CSV data and it built up an HTML table with raw strings.

Try Export-CSV for a quick way.

As for the email bit: http://blogs.technet.com/b/techniatures/archive/2012/08/13/sending-e-mail-via-powershell-script.aspx

You could attach the CSV or simply assign your Get-Datacenter ... query to a variable and then output that to the body of the email.

Reply
0 Kudos