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

Badges
MCSE
Community

Cozumpark Bilisim Portali
How to change memory of virtual machines on SCVMM 2012 R2 via PowerShell
Posted in Virtual Machine Manager, Windows Powershell, Windows Server | No Comment | 2,126 views | 02/06/2014 09:35

If you need to increase memory of your virtual machines, you can use following script.

You need to create a txt file like:

VM01;2048
VM02;4096

Save it as Memory.txt and run following script:

1
2
3
4
5
6
7
8
9
10
$Servers = Get-Content Memory.txt
foreach ($Server in $Servers)
{
	$ServerName = $Server.Split(";")[0]
	$ServerName = $ServerName.Split(".")[0]
	$Memory = $Server.Split(";")[1]
	Stop-VM $ServerName
	Get-VM $ServerName | Set-VM -MemoryMB $Memory
	Start-VM $ServerName	
}

So that will stop VM, change memory and start VM again.



Leave a Reply