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

Get the maximum IOPS

A quick post that is triggered by a tweet from @GernotNusshall I saw passing today. He wanted to know how to find the maximum IOPS values over the last 5 minutes for a number of VMs. The IOPS values are readily available from the vSphere statistics but the problem is that the values are returned as summation values over the measuring interval and that you have a read and a write value.

An ideal job for PowerShell to get the values Gernot was after.

Continue reading Get the maximum IOPS

Hitchhiker’s Guide to Get-EsxTop – Part 2 – The wrapper

In an earlier post, see Hitchhiker’s Guide to Get-EsxTop – Part 1, I described my first experiences with the new Get-EsxTop cmdlet. While the use of the cmdlet is rather straightforward, the data it returns is not so easy to interprete. Luckily Carter intercepted a secret cable that allows us to actually use the data returned by the cmdlet.

The following is my first attempt to write a wrapper around the Get-EsxTop cmdlet. The idea is to have a script that produces statistical data similar to what resxtop produces.

Continue reading Hitchhiker’s Guide to Get-EsxTop – Part 2 – The wrapper

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

PowerCLI Book Update 2

What started of as a very hazy concept about a year ago, now became something very concrete.
Our PowerCLI book will be released from the Sybex warehouses on March 28th.

About a week later you should see it appearing in a store near you ;-).

We set up a dedicated website  at https://powerclibook.com.

For now that site is read-only, but we will open up the forum soon, so you will be able to leave comments and ask questions concerning the book.

Small hint, on that site you will also find a number of links to pre-order the book!

Hitchhiker’s Guide to Get-EsxTop – Part 1

The PowerCLI Dev Team gave us an early XMas present yesterday. They released PowerCLI 4.1.1 build 332441 or PowerCLI 4.1 Update 1 as it is called in the Release Notes.

As usual there is a nice collection of new cmdlets and improvements on existing cmdlets in this new PowerCLI 4.1.1 build. Two of the new cmdlets that jump out for me are the Get-EsxCli and the Get-EsxTop cmdlets.

Although both cmdlets are still marked as ‘experimental’, they both open up a complete new area for automation. In this post I’ll have a closer look at the Get-EsxTop cmdlet and what you can do with it.

Continue reading Hitchhiker’s Guide to Get-EsxTop – Part 1

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!