Virtual Guest Console Fling.
This is a guest post by Andy Grant.
The VMware Guest Console was released well over a year ago but never caught my interest until working in my home lab Tuesday night of last week. As a VMware admin or consultant you may or may not be responsible for making large scale changes to the guest OS landscape. If you are, read on.
As the second Tuesday of the month it was Microsoft’s monthly patch release. Being patch Tuesday wasn’t unique about my situation, but as my home lab has recently crested 20 permanent VM’s, and 10 are Windows Server guests, it has meant more administrative time to maintain things.
I dutifully began installing the latest updates and rebooted each VM only to notice a significant increase in VM and host CPU utilization. My single HP Proliant server normally sits around 12-13% CPU usage but after the updates it jumped to ~95% and stayed there. With a little investigation it didn’t take long to notice the trend; mscorsvw.exe on each Windows Server VM was using 100% CPU. Using Process Explorer, I enabled the Command-Line column to get the full path of mscorsvw.exe which indicated that Microsoft .Net Framework 4 was the culprit. Now I don’t like to jump to conclusions so I did a quick Google search to determine why .Net was behaving this way, and came upon a blog post from 2005, What is mscorsvw.exe and why is it eating up my CPU? What is this new CLR Optimization Service?
The synopsis is that Microsoft released a .Net 4 update with Tuesday’s patches and this kicks off a recompilation of assemblies which consumes a great deal of CPU cycles. Multiply this for each VM and my single host was maxed.
Having come from a Microsoft administrative background, I could have used System Center or similar tool to disable the service on these guests in one fell swoop, but I don’t have that luxury in my lab. During that time I was downloading the latest update for the PXEManager fling and decided it was time to try out VGC to see how useful it could be in this situation.
Was it like SysInternals PsExec where I could execute guest level commands at each VM? It turns out that VGC uses vmrun for in-guest command execution.
At this point all I needed to do was figure out how I could stop all the mscorsvw.exe processes then disable the service.
Here’s what I did.
First, I needed to determine the service name, which I found in services.msc
Testing on my local workstation I determined that I would need the following commands to stop and disable the two services. There is a separate 32 and 64 bit service.
c:\windows\system32\net.exe stop clr_optimization_4.0.30319_32
c:\windows\system32\sc.exe config clr_optimization_4.0.30319_32 start= disabled
c:\windows\system32\net.exe stop clr_optimization_4.0.30319_64
c:\windows\system32\sc.exe config clr_optimization_4.0.30319_64 start= disabled
The absolute path is required for vmrun to find the executable. If you leave out the full path you may encounter an error such as “VIX – A file was not found”.
After logging in to VGC I browsed to the Virtual Machines tab and sorted the VM’s by OS Type.
The biggest time saving feature is that you can execute tasks on multiple VMs simply by selecting them from the list.
Before you try and run any command, you will need to provide administrative rights for the guest OS.
After logging in, select Applications –> New Task
Finally, enter the command you wish to execute.
Using the commands above, I first stopped the service then disabled it from starting on boot.
VGC turned out to be a great timesaver, instead of having to look up command references for VMrun, PsExec or even PowerShell, I was able to get the task done with little effort. I want to thank Ravi Cherukupalli, Rahul Chandrasekaran and Uttam Gupta for their efforts and for sharing this great little app.