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.
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
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
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.
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
}
Thanks a2alpha & LucD.
This is a quick & exact solution