Skip to content

Instantly share code, notes, and snippets.

@technion
Created July 14, 2020 03:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save technion/f984c723212bbc2009cbb9691f24d93f to your computer and use it in GitHub Desktop.
Save technion/f984c723212bbc2009cbb9691f24d93f to your computer and use it in GitHub Desktop.
Report on whole VM cluster in csv format
$nodelist = Get-Clusternode -Cluster cls
$vmdata = @()
foreach ($node in $nodelist) {
$vmList = Get-VM -ComputerName $node.Name | where { $_.name -notlike '*_replica' }
foreach ($vm in $vmList) {
$UtilSummaryObj = New-Object System.Object
$UtilSummaryObj | Add-Member -type NoteProperty -name VMName -Value $vm.Name
$UtilSummaryObj | Add-Member -type NoteProperty -name VMState -Value $vm.State
$UtilSummaryObj | Add-Member -type NoteProperty -name TotalCPU -Value (Get-VMProcessor $vm).count
$ram = ($vm.MemoryStartup)/1073741824
$UtilSummaryObj | Add-Member -type NoteProperty -name TotalRamGB -Value $ram
$disksize = ($vm.HardDrives | Get-VHD -ComputerName $node.Name | Measure-Object Size -Sum).sum/1073741824
$UtilSummaryObj | Add-Member -type NoteProperty -name TotalDiskGB -Value $disksize
$UtilSummaryObj | Add-Member -type NoteProperty -name Node $node.Name
$vmdata += $UtilSummaryObj
}
}
$vmdata | Export-Csv -NoTypeInformation nxt-cls-2019.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment