VMware Cloud Community
heskez
Contributor
Contributor
Jump to solution

Snapshot info output to html

Hi There,

I've got this nice oneliner to show some snapshot info:

"Get-VM | Get-Snapshot | Select VM,Name,Description,SizeMB"

I'd like to fetch this output and output it to an html file.

Is there any way to achive this?

Thanks,

Erik

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Since you have access to the .Net functions from PowerShell, you can do

Get-VM | Get-Snapshot |

Select VM,Name,Description,@{N="SizeGB";E={[math]::Round($_.SizeGB,0}} |
ConvertTo-HTML | Out-File C:\Scripts\Test.htm


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

View solution in original post

0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

Sure is, the smiplest way to create HTML output is

Get-VM | Get-Snapshot | Select VM,Name,Description,SizeMB |
ConvertTo-HTML | Out-File C:\Scripts\Test.htm

You can go very far with this when you start using style sheets.


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

0 Kudos
drivera01
Enthusiast
Enthusiast
Jump to solution

Not trying to be nosey, but I like his initial request to LucD. I do some what  the same, but my output for MB is always a large honkin' number. Any way to round up/down request whole intergers only?  3423.786587587587658  would like 3424

preferably in GB not MB, whole intergers of course...

again  sorry for being nosey...

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Since you have access to the .Net functions from PowerShell, you can do

Get-VM | Get-Snapshot |

Select VM,Name,Description,@{N="SizeGB";E={[math]::Round($_.SizeGB,0}} |
ConvertTo-HTML | Out-File C:\Scripts\Test.htm


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

0 Kudos
heskez
Contributor
Contributor
Jump to solution

Also very nice, thanks!

best regards,

Erik

0 Kudos