Friday, November 12, 2010

VMware PowerCLI script to manage VM resources

T.G.I.F.

A few months ago I talked about memory limitation and the impacts it could make on your guest’s performance.

So, you may be wondering what guest’s have limitation.
With this cool PowerCLI script you can identify the limits on your guests very quickly.

Let’s see how it works:

- start PowerCLI
- run: get-vm | get-vmresourceconfiguration | select VM,MemLimitMB

Guest’s with MemLimitMB = -1 means unlimited

Obs: there are a lot of other settings on the vm resource configuration, if you run the command without the “select” section you will see all of them.

Now that you know what are the memory limits on you guests, it’s time to adjust it
Again another PowerCLI script can make it happens very fast, instead of going server by server through Virtual Center.

- start PowerCLI
- run: get-vm | get-vmresourceconfiguration | Set-VMResourceConfiguration -MemLimitMB "value or $null"

Obs1: $null means unlimited
Obs2: If you want to specify just a few VMs, you need to setup a variable a place it just after get-vm command, see the PowerCLI basics if you don’t know how.

Have a good weekend all

1 comment:

Josh A. said...

Thanks for this post. This was exactly what I was looking for. I had a rogue template that was misconfigured and now I'm able to locate all of those VMs affected and make the necessary config changes. I appreciate your effort on this post.

Post a Comment

Who am I

My photo
I’m an IT specialist with over 15 years of experience, working from IT infrastructure to management products, troubleshooting and project management skills from medium to large environments. Nowadays I'm working for VMware as a Consulting Architect, helping customers to embrace the Cloud Era and make them successfully on their journey. Despite the fact I'm a VMware employee these postings reflect my own opinion and do not represents VMware's position, strategies or opinions.

Most Viewed Posts

Blog Archive