Getting information about Guest in table

Version 1

    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....

     

    Sorry my bad english im brazilian!!

     

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