Events – Part 5 : Powered off for more than 1 week ?

An interesting question was raised in the PowerCLI community by Jörn. He wanted to find all the guests that had been powered off for more than a week.

Before you tackle such a request, it is useful to sit down and think a bit about the solution. If you are going to search through all the events in your vCenter to answer this question, you could be in for a surprise. Depending on the size and activity of your vSphere environment this straight-forward solution could run for hours !

But there is a better way of doing this.

Continue reading Events – Part 5 : Powered off for more than 1 week ?

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

PowerCLI and the SDK – part 3 – Steve Jin’s best practices

Steve Jin, author of the VMware VI and vSphere SDK: Managing the VMware Infrastructure and vSphere book, recently started his DoubleCloud blog. In a short time span he produced several high quality posts which should be a must-read for every SDK user.

In his latest post, Top 10 Best Practices Using VMware VI and vSphere SDK (part 1), Steve gives invaluable advice for working with the SDK.

Since most of the SDK samples are (still) in Java, and since I know there are quite a few SDK users coming from the PowerCLI world, I decided to write up on some of Steve’s best practices for PowerCLI users.

And I hope Steve doesn’t mind 😉

Update: I thought it would make it easier for the reader to group all the SDK best practices and tips & tricks together. So I created a dedicated page, see SDK.

dvSwitch scripting – Part 6 – Private VLAN

Another post in the dvSwitch series. This time I’ll tackle the creation and use of a private VLANs (PVLAN) on a dvSwitch.

For those that are not that familiar with PVLANs have a look at KB1010691, that article gives a good overview of the PVLAN concept. And there were several sessions during the last VMworld that talked about PVLANs. The most noteworthy being TA2525 VMware vSphere 4 Networking Deep Dive.

In short, PVLANs allows isolation for guests on a shared IP subnet.

Continue reading dvSwitch scripting – Part 6 – Private VLAN

Alarms – Cody’s Abandon Ship

Yesterday, Cody published on his Professional VMware blog an excellent article, called vSphere Host Died Abandon Ship! – vSphere vCenter Alarms & Actions.

The article shows a very elegant solution how to move your guests to “safer havens”, the moment one of the hosts in the cluster starts experiencing hardware problems.
The elegance of Cody’s solution is that he uses maintenance mode to force vMotion on all the powered-on guests on the host that experiences HW problems.

Continue reading Alarms – Cody’s Abandon Ship

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

PowerCLI & vSphere statistics – Part 3 – Instances

In PowerCLI & vSphere statistics – Part 1 – The basics I briefly mentioned instances. In this post I’ll go a bit deeper into that subject.

And to demonstrate it all I will use part of the esxtop post on Yellow Bricks. In that post Duncan compiled, from various sources, a number of “common sense” thresholds that you can use in esxtop to show you possible problems with your hosts and/or guests.

Since I’m not sitting 24/7 behind an ESX/ESXi console, I looked for a way to let PowerCLI/PowerShell do that for me 😉

Continue reading PowerCLI & vSphere statistics – Part 3 – Instances

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

PowerCLI & vSphere statistics – Part 1 – The basics

Another popular subject in the VMTN PowerCLI community are statistics. Quite often it’s not entirely clear to the user what is available, how the data can be extracted and how PowerShell/PowerCLI can be used to convert the raw metrics into usable reports.

Before you can fully use all that is available, there are a few key concepts that you should understand.

In this series I will try to explain some common questions.

Continue reading PowerCLI & vSphere statistics – Part 1 – The basics