VMware Cloud Community
TheVMinator
Expert
Expert
Jump to solution

Best way to email report

What is the best way to modify this report in order to send it as a csv and an html attachment using an smtp server? 

Get-VIEvent -MaxSamples ([int]::MaxValue) -Start $start -Finish $finish |

Where-Object {"VmCreatedEvent","VmClonedEvent","VmDeployedEvent" -contains $_.Gettype().Name} | %{

    $evtThisNewVMEvent = $_

    Get-VM -Id $_.Vm.VM |

    Select @{N="VM Name";E={$_.name}},

    @{N="Memory (GB)";E={$_.MemoryGB}},

    @{N="Created Time";E={$evtThisNewVMEvent.createdTime}}

} | export-csv -path "c:\vmscreated.csv" -NoTypeInformation 

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You can use something similar as in Re: Emailing results of a PowerCLI report


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

View solution in original post

Reply
0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

You can use something similar as in Re: Emailing results of a PowerCLI report


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

Reply
0 Kudos
TheVMinator
Expert
Expert
Jump to solution

Thanks - it did work using that format.

Reply
0 Kudos