Created
July 14, 2020 03:43
-
-
Save technion/f984c723212bbc2009cbb9691f24d93f to your computer and use it in GitHub Desktop.
Report on whole VM cluster in csv format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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