Hello All,
I am looking for a powercli script that can fetch ESXi host connection state such as Host disconnected or non responding,
Thanks in advance
Moderator edit by wila: Moved to PowerCLI discussions
Like this?
Get-VMHost | Select Name,State
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
No Lucd, it will give output to all connected and disconnected hosts. I need only disconnected hosts and non-responding lists and the output will be sent to mail.
thanks.
That is not what you asked for with "I am looking for a powercli script that can fetch ESXi host connection state such as Host disconnected or non responding,".
Plus now you all of a sudden have an email requirement.
Sorry, I'm not falling for these never-ending threads anymore.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I managed to get disconnected host in powercli output. i want this output to be send to the mail. trying below but its not working as expected.
Get-VMHost |Where{$_.ConnectionState -eq 'Disconnected'} |Select Name,ConnectionState
Send-MailMessage -from 'mail@.test..com' -to "mail@.test.com.com' -Subject 'Report' -smtpserver 'smtp server'
You need to use the Body parameter on the Send-MailMessage cmdlet.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference