Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 192300

Re: ESX / DATASTORE details in inventory list.

$
0
0

Hello, -

 

Several of those can be had via the normal properties returned from Get-VMHost, and the rest you can pretty much get with calculated properties.  Like:

 

Get-VMHost | Foreach-Object {
   
## get the GenericMeasureInfo for this host's datastores, to be used for the output
    $mioThisHostsDStoreInfo=Get-Datastore -VMHost $_ | Measure-Object-Property CapacityGB,FreeSpaceGB -Sum
   
$dblCapGB= ($mioThisHostsDStoreInfo | ?{$_.Property -eq"CapacityGB"}).Sum        ## datastore capacity
    $dblFreeGB= ($mioThisHostsDStoreInfo | ?{$_.Property -eq"FreeSpaceGB"}).Sum    ## datastore free
    Select-InputObject$_ @{n="hostname"; e={$_.NetworkInfo.HostName}},
        @{n
="IP"; e={($_.NetworkInfo.VirtualNic | ?{$_.ManagementTrafficEnabled -eq$true-and$_.IP}).IP}},
        Model,ProcessorType,CpuTotalMhz,CpuUsageMhz,
        @{n
="CputAvailableMhz"; e={$_.CpuTotalMhz -$_.CpuUsageMhz}},MemoryTotalGB,MemoryUsageGB,
        @{n
="MemAvailableGB"; e={$_.MemoryTotalGB -$_.MemoryUsageGB}},
        @{n
="TotalDStoreSizeGB"; e={$dblCapGB}},
        @{n
="DStoreUsedGB"; e={$dblCapGB-$dblFreeGB}},
        @{n
="DStoreAvailableGB"; e={$dblFreeGB}},
        @{n
="PNicCount"; e={($_.NetworkInfo.PhysicalNic | Measure-Object).Count}}
}
## end foreach-object

 

Note about the datastore space:  handling uncommitted space (due to thin virtual disks) is not covered here, but you can add that in.

 

How does that do for you?


Viewing all articles
Browse latest Browse all 192300

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>