VMware Cloud Community
nava_thulasi39
Jump to solution

Help with report script

Hi,

This query might be already answered. But I couldn't find it.

I want to create the report for all esx servers basic information based on the Clusters.

I need in this format

Get-vmhost | select Name, Build, Version,MemoryTotalMB,Numcpu,Manufacturer,Model | export-csv c:\Test.csv -notypeinformation

Instead of MemoryTotalMB, I need it in MemoryTotalGB

So now my requirement is

--------------------------------------------------------------------------

Cluster name

      |

Esx server basic information like mentioned earlier.

---------------------------------------------------------------------------

Hope, Our Powercli expert help to create this report.

Thanks in advance.

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Something like this

$report = foreach($clus in Get-Cluster){
    Get-vmhost -Location $clus | `
    select @{N="Cluster";E={$clus.Name}},         Name, Build, Version,@{N="MemoryGB";E={$_.MemoryTotalMB/1KB}},Numcpu,Manufacturer,Model } $report | export-csv c:\Test.csv -notypeinformation


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

View solution in original post

0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

Something like this

$report = foreach($clus in Get-Cluster){
    Get-vmhost -Location $clus | `
    select @{N="Cluster";E={$clus.Name}},         Name, Build, Version,@{N="MemoryGB";E={$_.MemoryTotalMB/1KB}},Numcpu,Manufacturer,Model } $report | export-csv c:\Test.csv -notypeinformation


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

0 Kudos
nava_thulasi39
Jump to solution

Hi LucD,

Excellent.

1 more fine tuning required in the script,

MemoryGB comes as a floating number (ex: 23.99902344), So is it possible to change it for integer number (ex: 24)?

Thanks in advance.

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
0 Kudos
a2alpha
Expert
Expert
Jump to solution

Hi

If you modify the script above with this it should work for you.


{N="MemoryGB";E={([Math]::Round($_.MemoryTotalMB/1KB))}}

Cheers,

Dan

[SO]

$report = foreach($clus in Get-Cluster){
    Get-vmhost -Location $clus | `
        select @{N="Cluster";E={$clus.Name}},
        Name, Build, Version,@{N="MemoryGB";E={([Math]::Round($_.MemoryTotalMB/1KB))}},Numcpu,Manufacturer,Model
       }

nava_thulasi39
Jump to solution

Thanks a2alpha & LucD.

This is a quick & exact solution Smiley Happy

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
0 Kudos