Category Archives: PowerGUI / VESI

We’re writing a book

PowerCLI 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.

To answer some of your questions:

Q: What’s the title ?
A: Well, in the end we went for “VMware vSphere PowerCLI Reference: Automating vSphere Administration

Q: Why ?
A: We’re both crazy enough to think we can do this.

Q: When ?
A: Our publisher, Sybex, targets 2011 Q1

Q: What ?
A: Expect a practical, down-to-earth approach. We’re going to show you how you can manage all aspects of your vSphere environment with PowerCLI.

Q: Who are these guys ?
A: Alan, who recently joined EMC’s vSpecialist army, is well-known from his Virtu-Al blog, his UK VMUG appearances, as a co-host of the Get-Scripting podcasts and as the winner of the recent Script-O-Mania contest.
Luc, aka LucD, is known from the PowerCLI Community, his LucD notes blog, his Dutch VMUG and VMworld appearances and as the winner of the first PowerCLI Scripting contest.

Q: Where do these guys live ?
A: Alan, contrary to some rumours, is an English guy and lives in Wiltshire, UK.
Luc lives in Belgium and works in the Netherlands. The best of both worlds 😉

PowerShell / PowerCLI / VESI & the Dutch VMUG

You may have noticed a distinct lack of posts from me recently, I have been on holiday, I had a great time staying in Belgium and The Netherlands, a fantastic country which I would recommend to anyone thinking about travelling in northern Europe, not just for the red lights or “space cakes” either !

Whilst preparing for my trip I heard that the famous “Dutch VMUG” was having a PowerCLI / VESI event, now I know I was on holiday but it would have been rude to pass within an hour of the area and not attend 😉  and I was glad I did.

Having presented at a few VMUGS now I was very impressed at how organised the Dutch VMUG members really are, the presentations were submitted before hand and everything was set for the date well in advance, there were some real superstars presenting too, Armin van Lieshout, Arne Fokkema and Viktor van den Berg.

Continue reading

PowerCLI: Configured Maximums – Storage

With vSphere introduced some new maximum’s which we not only have to memorise for the exams but also have to keep in mind when designing and using your infrastructure.

In the back of your mind when adding a new host to a cluster you should always be thinking, how many hosts should be in this cluster ? or when adding another LUN to your clustered hosts, how many datastores should I have as a maximum before it starts impacting my performance and how many paths are supported ?

The answer to these questions (in my case anyway) is to use PowerCLI to check them 🙂

I will of course add these to the next version of vCheck so they are automatically checked for but in the meantime here are some quick one-liners to check your infrastructure against the configured maximums for storage, I will add more as I write them:

Continue reading

PowerCLI: Working with events

Today a question was asked of me, someone asked how to find out who had deleted a ResourcePool, now im not one to get anyone into trouble but I also cant resist a scripting challenge so here was the process I used to write the following one-liner:

Get-VIEvent | Where { $_.Gettype().Name -eq "ResourcePoolDestroyedEvent"} | Select CreatedTime, UserName, FullFormattedMessage

Ok, so we know that everything we do in the vSphere client produces an event so there must have been an event record, in this record we know that the person is recorded as we can easily create a test resource pool and delete it, this will allow us to test the information we need:

image

Continue reading

PowerCLI: Virtual Machine disk usage

Recently I have had a few comments on an old post I wrote showing a one-liner to get the VM’s disk sizes for each VM, I was asked if there was a way to export this information into a CSV file.

The easy answer is yes but what you need to do is build up a container and then add each part of the information to the container, this is quite common practice in PowerShell, its a great technique where you can basically build and populate your own information and then just add to it, once you are completed you can then take your container and export it to whatever format you wish, for example:

The one-liner mentioned in my previous post simply outputted the data one VM at a time to the screen, whilst this was great for looking at the information, when we try and export it things start to go wrong !

The new script, below, may take up more lines but is far more efficient and adaptable.

image

Continue reading

PowerCLI: Scripting ESXi

As the service console is moved further away from the hypervisor, people are finding it harder to configure ESX in the same way as has been done in previous versions.

Moving forward the only way to do this really is by accessing ESXi through the API using scripting toolkits such as PowerCLI or the Perl toolkit.

There are two basic versions of ESXi “free” and “licensed”, the scripting toolkits are limited to read-only access for the free version of VMware ESXi. When the host is upgraded to vSphere Essentials, vSphere Essential Plus, vSphere Standard, vSphere Advanced, vSphere Enterprise, or vSphere Enterprise Plus these toolkits have write-access enabled and provide a scriptable method for managing ESXi hosts. Continue reading

PowerCLI: Automating traffic shaping on portgroups

I was contacted by someone who needed to automate some changes to their virtual infrastructure, I can never resist a challenge so of course I agreed to help.

He worked for a Virtual Hosting platform who offer hosting at a low cost of entry.  Each customer where he works is provided with a dedicated  virtual machine, a public IP space in a logical VLAN.   As such his platform is currently 9 hosts, 190 VM’s and 60 Portgroups/VLAN’s. The platform is based on HP c700 Chassis with Cisco 3020 gig switches, with each “half” of the chassis trunked back to our core with a 2Gbps etherchannel. Each Blade’s “production” interface is connected to each “half” of the chassis at 1Gbps with originating VM id based load balancing. Continue reading

PowerCLI: Comparing Clusters

A simple one-liner for today, I needed to check all our current clusters and ensure all the ‘Production’ clusters were set the same, now we could go to each one and look at the settings but in this wonderful PowerCLI world we live why would you do anything more than once ?

The code is simple:

Get-Cluster | Select Name, * -ExcludeProperty id, CustomFields, ParentId | Sort Name | Out-GridView

The Get-Cluster cmdlet gets all the cluster information and then we simple exclude a few of the items I am not really interested in and then push the output through Out-GridView to display a nice filterable table as below:

Cluster

Continue reading

VESI & PowerGUI PowerPack V3

V3 Nodes

The popularity of this PowerPack never ceases to amaze me, as if it wasn’t enough to have more than 2500 downloads already it was also mentioned by the great Eric Sloof at the recent Dutch VMUG, check out a video of the session here (if you speak Dutch) or check out his slide deck here.

So, I have been working on V3 of the PowerPack and have just finished the final touches.

What’s new ?

To be honest I cant remember everything that is new but as you can see from the left hand node list there are a fair few new nodes which may help in your day to day admin life.

I have not only added my own enhancements but also included a bunch of bug fixes, (thanks Arnim and Luc) and also included some other scripts from Arne over at ICT-Freak.nl

I have re-organised some of the nodes so when you add the latest PowerPack you will receive a prompt like the below:

V3_Move_Nodes

Make sure you click yes to re-organise the nodes into the new areas.

I have also made a dependency on PowerCLI V4.0 Update 1 so if you do not have that version installed then please install it before upgrading to the latest PowerPack, you will not need vSphere 4.0 U1 as PowerCLI 4.0U1 is backward compatable.

In the latest version of PowerCLI VMware have made the connection methods a million times better, if you look at the code you will now see how easy it is to paste your new code into the nodes and create your own enhancements.

So what’s next for V4 ?  More of the same great scripts, more enhanced nodes, a move towards more actions and less nodes, and I am also thinking about opening this up as a community project, we can all add our own scripts to the PowerPack as a community effort and make this THE ULTIMATE FREE TOOL to have when administering or consulting VMware systems, express your interest via the comments please.

If your not a scripter but would like to see something in the PowerPack to make your life easier also please let me know via the comments.

Use the automatic update feature or download the new version now from below.