itayms
Contributor
Contributor

powered off VM's

Hi,

i need help, i need a script that list all powered off windows vm's and send them in daily mail.

thanks,

Itay

0 Kudos
1 Reply
LucD
Leadership
Leadership

You can do something like this

$vms = Get-VM | where {$_.PowerState -eq "PoweredOff"} | Select Name
Send-MailMessage -Subject "PoweredOff VMs" -To "lucd@lucd.info" `
 
-SmtpServer mail.lucd.info `
  -Body ($vms | Out-String) `
 
-From "VMware.report@lucd.info" 

If you schedule this script to run daily, you will get a daily email


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos