Getting information about Guest in table

Getting information about Guest in table

Hi Dear! I'm using this:

Get-VM | Select Name,VMHost,NumCPU,PowerState,MemoryMB,@{N="Datastore"; E={$_ | Get-Datastore}}

Output:

Name: pvmlxxxx
VMHost: php00xxxr
NumCpu: 2

PowerState : PoweredOn

MemoryMB   : 8192

Datastore  : VNXSxx

I need this output in .HTML:

Name|VMHost|NumCpu|PowerState|MemoryMB/GB|Datastore

Any can help me about this?

Tks Carlos

Try this

Get-VM | Select Name,VMHost,NumCPU,PowerState,MemoryMB,@{N="Datastore"; E={$_ | Get-Datastore}} | ConvertTo-HTML | Out-File report.html

You can of course produce much elaborate HTML output by using parameters on the ConvertTo-Html cmdlet, and by using style sheets (CSS).

See for example Using the ConvertTo-Html Cmdlet

LucD escreveu:

Try this

Get-VM | Select Name,VMHost,NumCPU,PowerState,MemoryMB,@{N="Datastore"; E={$_ | Get-Datastore}} | ConvertTo-HTML | Out-File report.html

You can of course produce much elaborate HTML output by using parameters on the ConvertTo-Html cmdlet, and by using style sheets (CSS).

See for example Using the ConvertTo-Html Cmdlet

Hi LucD

Tks! For your help!!

I try this in my profile

#### config  HTML ###############################

$aforma = "<style>"

$aforma = $aforma + "BODY{background-color:peachpuff;}"

$aforma = $aforma + "TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}"

$aforma = $aforma + "TH{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:thistle}"

$aforma = $aforma + "TD{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:PaleGoldenrod}"

$aforma = $aforma + "</style>"

##### End config ##################################

And script line:

Get-VM | Select Name,VMHost,NumCPU,PowerState,MemoryMB,@{N="Datastore"; E={$_| sort-object -property Name | Get-Datastore}} | ConvertTo-HTML -head $aforma| Out-File report_$DATTA.html

Its a simple script but....Smiley Happy

Sorry my bad english im brazilian!! :smileylaugh:

Este documento foi gerado a partir da seguinte discussão:  Getting information about Guest in table

Comments

Olá,

Você precisa abrir uma "Discussion" no forum correto.

Nesse caso você criou um documento no forum do brasil, eu aconselho que abra uma discussion no link abaixo que é especifico para dúvidas de powercli.

VMware vSphere™ PowerCLI

Version history
Revision #:
1 of 1
Last update:
‎09-12-2013 07:43 AM
Updated by: