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

Badges
MCSE
Community

Cozumpark Bilisim Portali
Hyper-V Cluster Memory Reports – v3
Posted in Windows Powershell, Windows Server | 3 Comments | 1,682 views | 23/06/2014 11:44

This is third version of Hyper-V Cluster Memory Reports.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
$Clusters = Get-Content Clusters.txt
foreach ($Cluster in $Clusters)
{
	[int]$TotalFreeMemory = 0;
	[int]$TotalMemory = 0;
	[int]$TotalUsedMemory = 0;
	[int]$NodeCount = 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) - ([math]::round(((Get-WmiObject -ComputerName $ClusterNode -Class Win32_OperatingSystem).TotalVisibleMemorySize / 1MB), 0)*10/100)
		[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]$UsedMemory = [int]$NodeMemory - [int]$FreeMemory
		[int]$TotalUsedMemory = [int]$TotalUsedMemory + [int]$UsedMemory;
		[int]$NodeCount = [int]$NodeCount + 1
	}
	[int]$TotalAvailableMemory = [int]$TotalFreeMemory - [int]$NodeMemory - ([int]$NodeMemory*10/100)
 
	Write-Host "Cluster: $Cluster"
	Write-Host "Total Memory: $TotalMemory"
	Write-Host "Total Free Memory: $TotalFreeMemory"
	Write-Host "Total Used Memory: $TotalUsedMemory"
	Write-Host "Total Available Memory: $TotalAvailableMemory"
	Write-Host "Node Count: $NodeCount"
 
	Write-Host " "
 
	$Value = $Cluster + ";" + $TotalMemory + ";" + $TotalFreeMemory + ";" + $TotalUsedMemory + ";" + $TotalAvailableMemory + ";" + $NodeCount + ";" + $NodeMemory
	Add-Content -Value $Value -Path Memory.txt
}

You should add your clusters into Clusters.txt file.


Comments (3)

Weekly IT Newsletter – June 16-20, 2014 | Just a Lync Guy

June 24th, 2014
22:11:55

[…] Hyper-V Cluster Memory Reports – v3 – […]


NeWay Technologies – Weekly Newsletter #100 – June 20, 2014 | NeWay

June 24th, 2014
22:14:36

[…] Hyper-V Cluster Memory Reports – v3 – […]


NeWay Technologies – Weekly Newsletter #100 – June 19, 2014 | NeWay

June 24th, 2014
22:16:08

[…] Hyper-V Cluster Memory Reports – v3 – […]



Leave a Reply