PowerCLI 4.0 Update 1- Another leap forward

Last week VMware released PowerCLI 4.0 Update1. According to the PowerCLI blog this new version contains over 60 new cmdlets as well as greatly improved performance.

One great thing is that they put the cmdlet reference online. I always like references online, because they are always at your disposal. When I ‘m working on my scripts, I have multiple servers/sessions running. I can now access the documentation from a server/session without having PowerCLI installed. I like it this way.

When going through the changelog I noticed a couple of improvements which I would like to highlight:

Improved the performance of Get-VM.

First of all let’s see what the promised performance improvement will bring us. When running the Get-VM cmdlet on a rather large environment it takes a while before your vms are returned. I decided to do a test run and see if I can notice any performance improvement of this cmdlet. I created a little script that performs the Get-VM cmdlet 10 times in succession and calculates the average time the cmdlet required to complete.

$a=@()
for($i=1; $i -le 10; $i++){$a += $(measure-command{get-vm}).totalseconds}
$a | measure-object –average

Running this test on the good old PowerCLI 4.0 gives me an average time of 46.89 seconds while running the same script on the new and improved PowerCLI 40 Update1 returns an average of 32.52 seconds. This is a performance improvement of 30%!

I did run the same test but now just retrieving one particular vm by name (Get-VM Server001). PowerCLI 4.0 needs an average of 11.36 seconds while the new PowerCLI 4.0 Update1 needs an average of 51.67 seconds to complete. This is a performance improvement of 78%! Wow.

So the PowerCLI team did a hell of a good job to drive performance to the max. Thank you!

Extended the Snapshot output object to contain extra information.

When retrieving snapshot information, the returned SnapshotImpl object now includes some new properties including a snapshot size property, which I think is really nice.

Extended the VMHost output object to contain extra information.

The VMHostImpl object has an extended set of properties which includes information on Server model and manufacturer, cpu and memory information as well as the installed ESX version.

Added support for working with multiple servers.

This is a really great feature that allows you to run your cmdlets/scripts against multiple servers. When you connect to a server using the Connect-VIServer cmdlet, the server connection is stored in the $DefaultVIServers array variable. This variable contains all connected servers for the current PowerCLI session.

To disconnect from a particular server use Disconnect-VIServer servername or disconnect all servers using Disconnect-VIServer *

You can switch back to single default server mode using the command Set-PowerCLIConfiguration -DefaultVIServerMode Single. But as stated in the documentation this is deprecated and will be removed in a following release. To switch back to the multiple VIServers mode, use the command Set-PowerCLIConfiguration -DefaultVIServerMode Multiple

When I was testing with this new feature I ran into a bug. Whenever you disconnect from a VIServer you cannot reconnect to that same server again. You can however connect to another VIServer, but never the same again. See my earlier blog post about this bug here.

There are a lot of other new features and improvements in the new U1 release. So go check it out now! http://blogs.vmware.com/vipowershell/2009/11/powercli-40-u1-is-out.html

Related posts:

  1. Setting custom attributes with VMware PowerCLI Tweet Last week I wanted to extend my vCenter with some extra custom attributes on my VMs. This would extend the usability of the Export List feature for reporting purposes....
  2. PowerCLI 4.0 U1 doesn’t reconnect to VIServer Tweet When I was testing with the new PowerCLI feature to work with multiple VIServers, I ran into a bug. Whenever you disconnect from a VIServer you can’t reconnect to...
  3. Reconnect ESX hosts using PowerShell Tweet This week I ran into problems with vCenter server and almost all of my VMs were orphaned in vCenter. To resolve this issue I needed to disconnect/connect each ESX...
  4. Export and import customization profiles using Powershell Tweet One great thing in the automation of VM deployments is the use of customization profiles. These profiles are stored inside the vCenter Server database. However, when you loose the...
  5. List HBA WWPNs and LUNs using Powershell Tweet Lately I’m moving around my VMs and storage luns between my ESX clusters a lot to accomplish a complete redesign of my Virtual Infrastructure. At some point I got...

3 Comments on “PowerCLI 4.0 Update 1- Another leap forward”

  1. #1 Alan Renouf
    on Nov 27th, 2009 at 4:00 pm

    Great post, didnt catch the snapshot size in there, very cool !

  2. #2 NiTRo
    on Nov 27th, 2009 at 7:25 pm

    As Al says, snapshot info is really cool. Thanks for your post :)

  3. #3 Info
    on Feb 5th, 2010 at 8:55 pm

    The example 2 on the following page incorrectly shows “DefaultServerMode” instead of “DefaultVIServerMode”:

    http://www.vmware.com/support/developer/windowstoolkit/wintk40u1/html/Set-PowerCLIConfiguration.html

Leave a Comment