Tag Archives: PowerGUI / VESI

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: Working with events

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: Virtual Machine disk usage

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: Scripting ESXi

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 PowerCLI: Comparing Clusters

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.

Exploring the PowerCLI cmdlets – Get-NicTeamingPolicy

One of the new cmdlets from PowerCLU 4.0 Update 1 is Get-NicTeamingPolicy, so what does this do ?

It retrieves the Nic teaming policies of the specified virtual switches and virtual port groups, obviously !

So how can we use this cmdlet ?

Well, as it details the teaming policies of either a virtual switch or a portgroup then we will need to give it a…virtual switch or a portgroup, so how do we do this, lets try a one-liner:

Get-VMHost | Get-VirtualSwitch | Get-NicTeamingPolicy

This will do as it says on the tin, get a list of the hosts, for each of these it will get a list of virtual switches attached to the hosts and then list their nic teaming policies, the output is as so:

Continue reading Exploring the PowerCLI cmdlets – Get-NicTeamingPolicy

Jump Start Virtualization EcoShell

I have talked about the Virtualisation EcoShell (VESI) enough on this blog for people to know what its all about but how do you get started ?

One option is to join the FREE live meeting tomorrow (1/12/2009) at 17:00 GMT (11:00 am Central Standard Time)  presented by Scott Herold by registering or joining here.  Anyone who has seen Scott present before will know how great the presentation will be and you are bound to pick up some expert tips from the man himself. Continue reading Jump Start Virtualization EcoShell

VESI & PowerGUI PowerPack V2

V2 Nodes

As the official download count for V1 of my PowerPack has now hit over 1000 downaloads (I cant thank you all enough), I have now released V2 of my PowerPack for VESI and PowerGUI, this is more like the version I wanted to release first time around.

In the first PowerPack, I took a fair few snippets of code I had written on my blog and added these to the PowerPack to get people interested, now in Version 2 I have added even more content, more nodes, more actions and a fair bit of user requested features.

As you can see from the image on the left, there are a fair few nodes (so many I had to cut and paste the image together as they wouldn’t all fit in one screen capture).

There are also some new actions (see screenshots below).

If you have ESXi hosts you should find this useful, now you will be able to download the current firmware state to your windows machine with the click of a button, deploy it back and also reset them back to default configuration (seen below).

I was also requested to add the vCheck script into this version so you could run ad-hoc reports on customer sites, you will find this under the General tab.

You will also find many more VM nodes, most of which where inspired by Armin van Lieshout who was a great help during the testing phase and even sent through his own code for me to include.  Thanks Armin.

Thanks to the other beta testers who sent me some great feedback (most of which is in here), I couldn’t have done it without you guys !  I also want to thank Kirk Munro who helped me out with a few coding or should I say User errors in V1 of this PowerPack 😉

Continue reading VESI & PowerGUI PowerPack V2

Virtu-Al VESI & PowerGUI PowerPack

I have been teasing people on twitter for a week or so now and have just uploaded my PowerPack to the PowerGUI site, you can download it here

image

As you can see from the screen shot on the left, this is a first attempt at providing most of my scripts in one PowerPack and adding to the already great management that VESI and PowerGUI give you.

So what do I need to do to install this ?

  1. Install PowerShell V1 or V2 (if you do not already have these installed) V2 Recommended
  2. Install PowerCLI
  3. Install VESI or PowerGUI (VESI Recommended for Virtualization management)
  4. If you have PowerGUI installed you will need to add the  ‘VMware Infrastructure Management’ PowerPack which can be downloaded from here.
  5. Click the download button at the top of this post to download my latest PowerPack, and rate the PowerPack while you are there if you like !
  6. Import the PowerPack into VESI or PowerGUI

From then on you will see both the VMware set of icons and the Virtu-Al icons, you will need to connect to a VI server or number of hosts using the ‘Managed Hosts’ section of the VMware PowerPack, once connected all icons (nodes) become active in the Virtu-Al.net powerpack, simply click on one to see the results.

If you want anything added or find something that doesn’t quite work, firstly make sure you have the latest version of the PowerPack by following this post, if it still doesn’t work please let me know, I am aware of a few bugs and have yet to put any actions in there but please, use it and give me your feedback !

I hope you find this useful !