Importance to set Dynamic Memory Maximum in Hyper-V 2012

In my little lab it was quite the time to do an rearm of the servers licenses as I had installed them with the evaluation version. This can be done with the slmgr.vbs /rearm command and a reboot.

Screen Shot 2013-07-23 at 11.08.23

And when I came to the second server where the domain controller resides I noticed that it consumed a lot of memory for just having the DC role.

Screen Shot 2013-07-23 at 11.14.26

When looking a bit closer I noticed sessions where me and a colleague that have been logged in but in disconnected mode and consumed both CPU and memory. In almost every server this is not optimal where Admins can stay logged in forever and this can be handled with a GPO setting to restrict the time for a disconnected session on servers residing in a specific OU.

 

Screen Shot 2013-07-23 at 11.18.52

 Another problem was that when I created the DC VM I just activated the Dynamic memory without setting any limits and this could cause a host with no physical memory left and VM´s going crazy with allocated memory. Setting the Startup memory is important but also setting the Maximum RAM, I have as a best practice to set the startup and Maximum to the same values.

Screen Shot 2013-07-23 at 11.21.41

With PowerShell I easily could change the settings of the VM to have a more reasonable maximum value than 1TB. And as you can see with the -PassThrough parameter I can do it in one line.

Screen Shot 2013-07-25 at 11.18.34
PS C:\> get-vm dc01 | Stop-VM -Passthru | Set-VM -MemoryMaximumBytes 2GB -Passthru | Start-VM

And after the DC restarted you can see that it only consumes 624 MB RAM.

Screen Shot 2013-07-23 at 11.34.37

Comments

Karthi
Reply

i need power shell script in Add RAM to VM

Leave a comment

name*

email* (not published)

website