2 Replies Latest reply on Sep 12, 2013 7:40 AM by CarlosDionizio

    Getting information about Guest in table

    CarlosDionizio Novice

      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

        • 1. Re: Getting information about Guest in table
          LucD Guru
          User ModeratorsCommunity WarriorsvExpert

          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

          Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
          • 2. Re: Getting information about Guest in table
            CarlosDionizio Novice

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