search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
Hyper-V Cluster Memory Reporting via PowerShell
Posted in Virtual Machine Manager, Windows Powershell, Windows Server | No Comment | 2,891 views | 19/12/2013 09:58

You can get memory reporting of your Hyper-V clusters via this script.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$Clusters = Get-Content C:\Cluster.txt
foreach ($Cluster in $Clusters)
{
	[int]$TotalFreeMemory = 0;
	[int]$TotalMemory = 0;
	$ClusterNodes = Get-Cluster $Cluster | Get-ClusterNode
	foreach ($ClusterNode in $ClusterNodes)
	{
		[int]$FreeMemory = [math]::round(((Get-WmiObject -ComputerName $ClusterNode -Class Win32_OperatingSystem).FreePhysicalMemory / 1MB), 0)
		[int]$TotalFreeMemory = [int]$TotalFreeMemory + [int]$FreeMemory
		[int]$NodeMemory = [math]::round(((Get-WmiObject -ComputerName $ClusterNode -Class Win32_OperatingSystem).TotalVisibleMemorySize / 1MB), 0)
		[int]$TotalMemory = [int]$TotalMemory + [int]$NodeMemory
	}
	[int]$TotalAvailableMemory = [int]$TotalFreeMemory - [int]$NodeMemory
 
	Write-Host "Cluster: $Cluster"
	Write-Host "Total Memory: $TotalMemory"
	Write-Host "Total Free Memory: $TotalFreeMemory"
	Write-Host "Total Available Memory: $TotalAvailableMemory"
	Write-Host " "
}

I suppose that your all Hyper-V nodes in Cluster has same memory size.



Leave a Reply