PowerCLI 4.1 brings the New-VIProperty cmdlet

In the new PowerCLI 4.1 build 264274 there are two new cmdlets, called New-VIProperty and Remove-VIProperty, that deserve your special attention.

The New-VIProperty cmdlet allows you to add a new properties to any PowerCLI object (InventoryItem, HostSystem, VirtualMachine…). And it’s up to you to define what the value of this new property will !

The Remove-VIProperty cmdlet allows you to remove such a new property.

These new cmdlets, combined with the new Extension property, will change several of the well established ways that you use in your PowerCLI scripts. And besides adding a lot of flexibility, the extension property will make your scripts considerably faster (if used wisely).

Continue reading PowerCLI 4.1 brings the New-VIProperty cmdlet

Script ‘esxupdate -query’

I received an interesting comment on my Events – Part 7 : Working with extended events – Update Manager post from Suresh. He wanted to know if it was possible to create a similar report with the vCenter Update Manager PowerCLI cmdlets as you can get with the esxupdate query command.

Continue reading Script ‘esxupdate -query’

Events – Part 6 : Working with extended events – Converter

In a previous post, called Events, Dear Boy, Events – Part 2, I mentioned that some tools/add-ons use a special event type called ExtendedEvent. Two classic examples are the Converter and the Update Manager. If you want to compile a report for any these tools it’s important to understand what is available in the extended events they produce.

If you want to know if there are any other tools/add-ons in your vSphere environment that produce extended events, then you can use the first script from the Events, Dear Boy, Events – Part 2 post to get a complete list of all available extended events.

In this post I’ll show how to use the Converter extended events.

Continue reading Events – Part 6 : Working with extended events – Converter

Debugging function – verbose vpxd logging

Today Steve Jin published a post called How to Enable ESX Server Logs for Troubleshooting. A very useful tip when you are looking for those hard-to-find “features” in your script.

Steve’s tipΒ  reminded me that I have a similar small function in my toolchest to do something similar for the vCenter log.

The function allows you to switch the vCenter log between “warning” and “verbose” on the fly. No need to go into the vCenter client to change the logging option anymore while debugging.

Continue reading Debugging function – verbose vpxd logging

Changing VMware Tools scripts

There was another interesting question on the PowerCLI community. Mike was wondering if it would be possible to change the VMware Tools scripts with a PowerCLI script. As far as I can see there are two options available with the VMware Tools scripts.

  1. You can run the default scripts that are installed on the guests when you install VMware Tools
  2. You can use Custom scripts and you have to specify the path of these scripts to VMware Tools

To use the 2nd option you will need, as William already pointed out, the VIX APIs.

But if you can live with the first option, and reuse the default scripts, the current PowerCLI build has all you need.

Continue reading Changing VMware Tools scripts

We’re writing a book!

Some of you might be interested to know, Alan and Luc are writing a PowerCLI book.

We don’t have many more details at the moment but wanted to let you know, as we are both very excited (and nervous by the amount of work) about this project.

As you know we both live and breathe PowerCLI. And we want to share our knowledge to help others achieve the level of PowerCLI automation we both know is possible.

One thing you can expect from this book is a practical approach with examples galore. We aim to cover most of the common configuration/troubleshooting and reporting areas with easy to understand examples and explanations.
Continue reading We’re writing a book!

Find unused portgroups in a cluster

Triggered by a recent post, see get-virtualportgroup, in the PowerCLI Community, I had a closer look at the Get-VirtualPortgroup cmdlet.

This cmdlet returns a VMware.VimAutomation.Types.Host.VirtualPortGroup object, which contains a very useful property called Ports. In that property it lists all the guests that are connected to a port on the portgroup. That would be the solution to find unused portgroups, I thought. But while the vSphere Client also shows powered off guests that are connected, the Port property returned by the Get-VirtualPortgroup cmdlet doesn’t. πŸ™

So the question at hand required a bit more scripting than I originally thought.

Continue reading Find unused portgroups in a cluster

UML diagram your VM, vdisks and snapshots

After my yadr – A vdisk reporter post I received an email from Dennis Zimmer, known from VMachine blog and as the IcomaSoft CTO. He pointed me to the yUML website and suggested that I could perhaps use part of the yadr script to produce an UML diagram.

As it happended there were already some PowerShell scripts that used the functionality offered by the yUML website to produce UML diagrams. Have a look for example at Use PowerShell and yUML to Create Diagrams by Doug Finke and Create Database Diagrams with Powershell + yUML by Chad Miller.

As you probably guessed by now I was sold to the idea.

Continue reading UML diagram your VM, vdisks and snapshots

yadr – A vdisk reporter

I know there are already numerous scripts to report on virtual hard disks and most of them without a doubt much better then what I came up with for this post.

The reason I started with this script was a question in the PowerCLI Community from Alan in his Thin Provisioned Disks post. He wanted to know if you could get the provisioned and the allocated disk size for a thin provisioned virtual disk.

Continue reading yadr – A vdisk reporter

Name that hardware

This post was triggered by the thread Retrieving ESX host hardware information in the PowerCLI community. In that thread at a certain point the NIC HW

information was missing. The solution was to use the classId, which is 0x0200 for NICs, as a filter on the HostPciDevice objects that are present under the pciDevice property in the HostHardwareInfo object.

That made me think that this would be an ideal way to list all the hardware present on a server. But to my surprise a lot of the entries are listed as “unknown”. Since the vendorId and the deviceId are known I knew that this could be improved.

Continue reading Name that hardware