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

Counter the self-aware VUM

Today there was quite a bit ofย  activity on Twitter following Jason Boche‘s blog post titled VMware Update Manager Becomes Self-Aware.
The problem Jason discovered was that the VUM skipped the guests which are hosting the VUM server and the vCenter server. As a consequence you can not select a cluster, select “remediate” and go out for lunch anymore. The resolution was a rather cumbersome and error prone manual procedure.
But of course PowerCLI can help the human vSphere administrator ๐Ÿ˜‰

Continue reading Counter the self-aware VUM

dvSwitch scripting – Part 8 – Get and Set network adapters

One of the feature requests that came up in several emails I received for my dvSwitch series, was how to get and set the network adapters of virtual guests. In the current PowerCLI version the Get-NetworkAdapter and Set-NetworkAdapter cmdlets can not handle portgroups on dvSwitches.

That is why I created the following two functions, called Get-dvSwNetworkAdapter and Set-dvSwNetworkAdapter.

Continue reading dvSwitch scripting – Part 8 – Get and Set network adapters

dvSwitch scripting โ€“ Part 7 โ€“ Find portgroup/Change VLAN Id

In a comment on one of the previous dvSwitch posts, see dvSwitch scripting โ€“ Part 2 โ€“ dvPortgroup, Gert asked how he could check if a portgroup with a specific VLAN Id existed on a distributed virtual switch.

Since a function that allows you to search for a portgroup that meets specific requirements can be quite useful, I decided to create a new function to do just that.

Additionally I will show in this post how you can change the VLAN Id of a specific portgroup.

Continue reading dvSwitch scripting โ€“ Part 7 โ€“ Find portgroup/Change VLAN Id

Alarms – Adding an action

An interesting question on Alarms arrived in my mailbox recently. Charlie wanted to know if it was possible to add an action to a selected set of the alarms he has defined in his vCenter.

The current PowerCLI build (version 4 update 1 – build 208462) unfortunately has no cmdlets to work with alarms. There are some alarm-related cmdlets available in the VI Toolkit for Windows Community Extensions. But none of these provides the functionality Charlie wanted to have.

Continue reading Alarms – Adding an action

dvSwitch scripting โ€“ Part 5 โ€“ Clone/pg to dvPG

An interesting question came up in the PowerCLI Community recently. Jason wanted to use a script from another thread where you could connect a NIC to a specific portgroup while cloning a new guest from a template.

The script didn’t work when the requested portgroup was on a dvSwitch. Enough of a reason for me to have another look.

Continue reading dvSwitch scripting โ€“ Part 5 โ€“ Clone/pg to dvPG

PowerCLI & vSphere statistics โ€“ Part 2 โ€“ Come together

The end of my previous post in this series, seeย PowerCLI & vSphere statistics โ€“ Part 1 โ€“ The basics, showed how you could get the statistical values for a specific day.

Depending on the point in time for which you request the values, the sampling interval will be different. For example Historical Interval 2 will return values measured over 30 minute intervals. See also the schematic I included in the previous post.

This sample interval is not always what you want for your reports. Suppose you want to always report hourly values and only for working hours during business days. This post will show you how to accomplish that.

Continue reading PowerCLI & vSphere statistics โ€“ Part 2 โ€“ Come together

Dutch VMUG event 2009 – handy scripts

Today the Dutch VMUG event 2009 took place. It was my first visit but this truly is an amazing event. Lots of knowledgeable and interested visitors.

During my session I showed some small, handy scripts that I use on a regular base. In fact they are stored in my profile.

As promised, here are the scripts.

Continue reading Dutch VMUG event 2009 – handy scripts

Events, Dear Boy, Events – Part 2

In a previous entry (see Events: a great source of information – Part 1) I showed how to use the VmCreatedEvent event to find out which guests were created longer than 30 days ago.

In the vSphere SDK documentation there are currently 432 events listed. That makes it sometimes hard to decide which event(s) to use for your reporting/auditing needs.

But luckily there are some tricks to make it easier on you.

Continue reading Events, Dear Boy, Events – Part 2

Scripts for Yellow Bricks’ advise: Thin Provisioning alarm & eagerZeroedThick

On the Yellow Bricks blog there was today a very interesting entry called Performance : Thin Provisioning. Besides the link to the excellent VMware document called Performance Study of VMware vStorage Thin Provisioning, Duncan also included some tips and tricks.

Since I’m in favour of automating as much as possible in my vSphere environment, I decided to have a look how all this could be scripted.

Continue reading Scripts for Yellow Bricks’ advise: Thin Provisioning alarm & eagerZeroedThick