Discover Memory Overallocations

With the vSphere 5 licensing buzz from the past days and the incredibel number of hits on my Query vRAM post, I considered that a script to help you discover your memory overallocations might be useful.

The script uses the metric mem.usage.average to find out what amount of it’s allocated memory a guest is actually using. The script produces a report that will help you to determine which guests would be good candidates to lower their memory allocation.

Continue reading Discover Memory Overallocations

Query vRAM

After the Cloud Infrastructure Launch Forum event from July 12th 2011, it seemed that the new licensing model attracted more blog posts and tweets than the 140 new features in vSphere 5.

As one could imagine, one of the most heard questions was, what will I need to pay in the new licensing model. As a pro-active measure, I decided to write a short script that would tell me what vRAM entitlement my current vSphere 4 licenses would offer me.

Update August 4th 2011 08:30: VMware updated the vRAM calculation specifications. See the VMware vSphere™ 5.0 Licensing, Pricing and Packaging White Paper.

Update July 13th 2011 14:45: Apparently you have a vRAM pool per license type. I updated the script.

Continue reading Query vRAM

Who acknowledged that alarm ?

Sometimes a solution to a problem is just staring you in the face.
While writing the PowerCLI book, I spent quite a bit of time on how to find which user acknowledged an alarm.
Today Eric “Scoop” Sloof launched the same question on Twitter. While I thought it was not possible, based on my past investigations, I decided to have a second look.

And of course now I found in a matter of minutes what had cost me fruitless hours before.

Continue reading Who acknowledged that alarm ?

Datastore usage statistics

An interesting question came up in the PowerCLI Community. Can one extract the datastore statistics, that are used for the space utilization graphs in the vSphere Client, with PowerCLI ? The graph in question, which you find in the Datastores Inventory view under the Performance tab, looks something like this.

Continue reading Datastore usage statistics

dvSwitch scripting – Part 9 – Traffic Shaping

Another interesting feature of a dvSwitch is the ability to use bidirectional traffic shaping. Besides the outbound traffic shaping that is available on regular virtual switches, with the dvSwitches we can also have inbound traffic shaping. The traffic shaping is defined with the three known, classical values: average bandwidth, peak and burst size.

Recently there were some threads in the PowerCLI Community that asked how to do this with PowerCLI. Time to add this to our repertoire of PowerCLI dvSwitch functions.

Continue reading dvSwitch scripting – Part 9 – Traffic Shaping

Orphaned files and folders – Spring cleaning

In our PowerCLI book we presented a Delete-Harddisk function in Chapter 7.

One of our readers asked if that function could be used to remove orphaned VMDK files from one or more datastores. Now unfortunately that is not the case since the function we presented in chapter 7 uses the ReconfigVM_Task method to remove the harddisk.

In the PowerCLI Community there are some thread that provide scripts to report on orphaned VMDK files, but most of these are quite old.

So I decided to write a new script that would report on orphaned folders and VMDK files and that would have an option to remove these folders and files.

Continue reading Orphaned files and folders – Spring cleaning

Virtual Machine logging

I recently received an interesting question in my mailbox. Someone wanted to know if it was possible to enable/disable the logging for a Virtual Machine through PowerCLI. These Virtual Machine logs can be a handy resource when analysing problems.
This logging option is available through the vSphere client when you select Edit Settings and then Options-Advanced-General. In that form there is a checkbox that allows you to enable/disable the virtual machine logging.

Afaik, this feature is not yet available through a PowerCLI cmdlet. But it is easily accessible through the VirtualMachine object.

Continue reading Virtual Machine logging

SIOC statistics

SIOC (Storage IO Control) is apparently a hot topic. There have been an important number of posts since it was made available with vSphere 4.1. On this blog, in my Automate SIOC post, you can find functions to verify and activate/deactivate SIOC from your PowerShell script.

A recent post on Yellow-Bricks, called Enable Storage IO Control on all Datastores! got quite a few comments and Tweets.

I was intrigued by one of the comments on Twitter that stated that the users didn’t understand what SIOC was all about. From several posts on SIOC I came to understand that the non-VI workload event would be fired when SIOC doesn’t see any latency improvements when it throttles the storage queue. Simple enough, but is there any data available that can make this visible ?

Continue reading SIOC statistics

Get your tasklog here!

It happens quite often that you launch a PowerCLI cmdlet or a call to a SDK method or a script and that you get a rather cryptic message that something went wrong. One source of information to find out what went wrong are the vCenter’s vpxd log or the ESX(i) server’s hostd log.

But these logs are flooded with messages and it’s often quite hard to find the messages that relate to your task.

When running against a vCenter Server you can set the vCenter’s Logging Options to “Verbose” or “Trivia“. That produces more information in the logs but that often also makes it harder to find/extract the information that belongs to your task. And who has never forgotten to set the the Logging Options back to their original state when done with debugging ?

To make life a bit easier, I wrote a function that automates the above steps. I expanded on a function that I was using privately, and made it more general. This function allows you to retrieve the log entries for one specific or all recent task. The function also allows you to pass a cmdlet, or even a complete script, run the script in an elevated Logging Options mode and returns the task-related log entries.

Continue reading Get your tasklog here!

Get the folderpath

A useful property that is obviously missing from the Get-Folder cmdlet, is the path of the folder. In the PowerCLI Community there are regularly threads that ask for this kind of information. Most of the time it concerns scripts to export/import folder structures or scripts to migrate vCenters.

Another property that is obviously missing, is the indication if a specific folder is a so-called “blue” or “yellow” folder.

To solve this problem once and for all, I wrote this short function, called Get-FolderPath, that will return you both of these properties.

Continue reading Get the folderpath