23 lines
1.1 KiB
PowerShell
23 lines
1.1 KiB
PowerShell
Add-PsSnapin VMware.VimAutomation.Core -ea "SilentlyContinue"
|
|
Connect-VIServer -Server "drahpwvvc01.vcenter.local"
|
|
|
|
$myCol = @()
|
|
ForEach ($Cluster in Get-Cluster)
|
|
{
|
|
write-host "Clustername : " $cluster.name
|
|
write-host "Number of Hosts: " ($cluster | Get-VMHost).count
|
|
ForEach ($vmhost in ($cluster | Get-VMHost))
|
|
{
|
|
$VMView = $VMhost | Get-View
|
|
$VMSummary = "" | Select HostName, ClusterName, MemorySizeGB, CPUSockets, CPUCores
|
|
$VMSummary.HostName = $VMhost.Name
|
|
$VMSummary.ClusterName = $Cluster.Name
|
|
$VMSummary.MemorySizeGB = [math]::round(($VMview.hardware.memorysize / 1024Mb))
|
|
$VMSummary.CPUSockets = $VMview.hardware.cpuinfo.numCpuPackages
|
|
$VMSummary.CPUCores = $VMview.hardware.cpuinfo.numCpuCores
|
|
$myCol += $VMSummary
|
|
}
|
|
}
|
|
#$myCol | export-csv -Path "c:\temp\dra.csv" -useculture -notypeinformation
|
|
$myCol | out-gridview
|