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

Badges
MCSE
Community

Cozumpark Bilisim Portali
Posted in Virtual Machine Manager, Windows Powershell, Windows Server | No Comment | 1,550 views | 23/12/2013 11:15

This script requires SCVMM 2012 SP1. You should execute it on SCVMM PowerShell:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$Pt = 0;
$VMs = Get-VM
foreach ($VM in $VMs)
{
	$VMName = $VM.Name
	$Cloud = $VM.Cloud
 
	if ($VM.PassThroughDisks)
	{
		$PassThroughDisk = "True"
		Write-Host $VMName
		Write-Host $Cloud
		$Value = $VMName + ";" + $Cloud
		Add-Content -Value $Value -Path C:\yusufozt\PassThroughDisks.txt
		$Pt++
	}
}
Write-Host "Total VM: $Pt"

You can export into Microsoft Excel for a table view.


Posted in Virtual Machine Manager, Windows Powershell, Windows Server | No Comment | 1,657 views | 23/12/2013 10:31

Merhaba,

Cumartesi günü Microsoft Türkiye’de yapmış olduğum PowerShell ile Hyper-V Yönetimi sunumunda kullanmış olduğum Powerpoint ve Demo dosyalarına aşağıdaki bağlantı üzerinden ulaşabilirsiniz.

Sunum dosyaları içerisinde düzenlediğimiz toplam 3 tane dosya var.

http\template\main.html: Tabloları yarattığımız html dosyası
http\js\custom\jquery.vm.reports.js: XML’i okuyup, yorumlayan jscript
Get-MyVMs.ps1: Hyper-V’den değerleri çekip XML haline getirdiğimiz dosya

Herkese kolay gelsin :)


Posted in Virtual Machine Manager, Windows Powershell, Windows Server | No Comment | 2,285 views | 19/12/2013 10:38

You can get memory reporting of your SCVMM Clouds via this script.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
$Clouds = Get-SCCloud
foreach ($Cloud in $Clouds)
{
	$VMs = Get-SCCloud $Cloud | Get-VM
	$VMCount = $VMs.Count
	$TotalMemory = [math]::round((($VMs | Measure-Object -Sum MemoryAssignedMB).Sum / 1KB), 0)
	$AvgMemory = [math]::round(($TotalMemory / $VMCount), 0)
 
	Write-Host "Cloud: $Cloud"
	Write-Host "VM Count: $VMCount"
	Write-Host "Total Memory: $TotalMemory GB"
	Write-Host "Avg Memory: $AvgMemory GB"
	Write-Host " "
}

You will also see average memory usage of your virtual machines.


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.


Posted in Virtual Machine Manager, Windows Powershell | No Comment | 3,049 views | 12/12/2013 15:11

This is my own notes for jumbo packet size configuration:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Get Jumbo Packet Size on Localhost
Get-NetAdapterAdvancedProperty -DisplayName "Packet Size"
 
# Setting Jumbo Packet Size on Localhost
Get-NetAdapterAdvancedProperty -DisplayName "Packet Size" | Set-NetAdapterAdvancedProperty -RegistryValue "9014"
 
# Creating New Cim Session for Remote Host
$CimSession = New-CimSession -ComputerName S0134VMHOSTT02
 
# Get Jumbo Packet Size on Remote Host
Get-NetAdapterAdvancedProperty -DisplayName "Packet Size" -CimSession $CimSession
 
# Setting Jumbo Packet Size on Remote Host
Get-NetAdapterAdvancedProperty -DisplayName "Packet Size" -CimSession $CimSession | Set-NetAdapterAdvancedProperty -RegistryValue "9014" -CimSession $CimSession

I hope that helps you to configure packet sizes easily.


Posted in Virtual Machine Manager, Windows Powershell | No Comment | 3,241 views | 12/12/2013 15:07

I use Custom1 section in SCVMM to set expiry date for virtual machines.

1
2
3
4
5
6
7
$Date = (Get-Date).AddDays(180).ToString("U")
$cp1 = Get-SCCustomProperty -Name Custom1
$VMs = Get-VM
foreach ($VM in $VMs)
{
     $VM | Set-SCCustomPropertyValue -CustomProperty $cp1 -Value $Date
}​​

I use System Center Orchestrator to check expiry dates.


Posted in Virtual Machine Manager, Windows Powershell | No Comment | 2,441 views | 12/12/2013 15:03

You can use this script to assign logical network to your Hyper-V hosts.
For example, in this script, “Test_Logical_Network” is assigned to all servers in Test Host Group.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
$VMHosts = Get-VMHost | Where VMHostGroup -like "All Hosts\Test*"
foreach ($VMNode in $VMHosts)
{
	$VMHostName = $VMNode.Name
	$Job = New-SCExternalJob -Name "$VMHostName Logical Network"
	$JobID = $Job.ID
	$VMHost = Get-SCVMHost $VMHostName
	$vmHostNetworkAdapter = Get-SCVMHostNetworkAdapter -VMHost $VMHost | Where ConnectionName -eq "VmNetwork_team"
	Set-SCVMHostNetworkAdapter -VMHostNetworkAdapter $vmHostNetworkAdapter -Description "" -AvailableForPlacement $true -UsedForManagement $false -JobGroup $JobID
	$logicalNetwork = Get-SCLogicalNetwork -Name "Test_Logical_Network"
	Set-SCVMHostNetworkAdapter -VMHostNetworkAdapter $vmHostNetworkAdapter -JobGroup $JobID -AddOrSetLogicalNetwork $logicalNetwork
	Set-SCVMHost -VMHost $VMHost -JobGroup $JobID -RunAsynchronously -NumaSpanningEnabled $true
	Set-SCExternalJob -Job $Job -Completed -InfoMessage "Logical network eklendi"
}​​

That will assign all VLANs in Test_Logical_Network to specific Hyper-V host.