VMware vSphere PowerCLI Reference: Automating vSphere Administration

It has been quite a journey, but it has finally arrived. Today our book: “VMware vSphere PowerCLI Reference: Automating vSphere Administration” will be released by Sybex. The journey started about a year ago when Alan Renouf and Luc Dekens decided to write a PowerCLI book that should have a practical approach to vSphere administration. Later that year they contacted 3 co-authors to help them out in order to keep meeting the deadlines. The PowerCLI book team was born and the book was to be written by “4 vExperts and a MVP”.

From this point I would like to personally thank Alan and Luc for the opportunity to realize a dream. I would also like to personally thank Mary Ellen Schutz, Developmental Editor, for transforming my technical gibberish into readable and most importantly understandable language. Last but not least I would like to personally thank our Technical Editor, Stuart Radnidge. He left no script unturned and served as the gatekeeper, ensuring that any code you find in the book will run the first time, every time. You might think that’s all there is to it, but then you’re wrong. I’ve never written a book before and I was impressed by the number of people that were involved behind the scenes in this book thing. On the Sybex team there were numerous people involved including but not limited to: Editorial Manager, Acquisition Editor, Production Editor, Copyeditor, Indexer, Proofreader and Compositor. Without each of their contributions, this book would have never made it to the presses.

Continue reading →

vSphere Client for iPad – Another step forward in mobile administration

Today VMware announced the release of the vSphere Client for iPad. The first great thing is that you can download the vSphere Client for iPad from Apple’s iTunes Store for FREE! The second great thing is that it looks really awesome and the interface is very intuitive.

VMware is taking mobility very seriously as this is their second application specifically for the iPad. Recently VMware released the VMware View Client for iPad. The vSphere Client for iPad isn’t meant to be a fully functional equivalent for the existing Windows client, but allows you to do the most common tasks, according to VMware. With the current release, the functionality offered by the vSphere Client for iPad is:

  • Search for vSphere hosts and virtual machines
  • Monitor the performance of vSphere hosts and virtual machines
  • Manage virtual machines with the ability to start, stop and suspend
  • View and restore virtual machines’ snapshots
  • Reboot vSphere hosts or put them into maintenance mode
  • Diagnose vSphere hosts and virtual machines using built-in ping and traceroute tools

The ability to manage your vSphere environment with a mobile device isn’t new, as VMware already provides the vCenter Mobile Acces (vCMA) virtual appliance. If you’re familiar with this vCMA, you might recognize the vSphere Client for iPad’s functionality. In fact it’s built on top of this vCMA. The vCMA is required in order for the vSphere Client for iPad to function and can be obtained from VMware free of charge at http://labs.vmware.com/flings/vcma The latest version of the vCMA has now SSL configured by default, to make sure your connection is secure. Because you connect to the vCMA virtual appliance using standard SSL, you can easily use the vSphere Client for iPad to connect to the vCMA through a firewall to manage your vSphere environment.

Continue reading →

Rescan VMware vSphere Hypervisor (ESXi) using PowerCLI simplified

While preparing some disaster recovery (DR) tests, I had to add and remove a couple of LUNS from several ESX hosts in different clusters. Doing so,  I had to rescan a lot of host bus adapters (HBA) several times. As I hate doing repetitive tasks in a graphical user interface (GUI), I always find myself quickly turning to the PowerCLI console. The PowerCLI command to rescan an ESX host is somewhere hidden in the Get-VMHostStorage cmdlet. This isn’t the most logical location and every time I have to perform a rescan operation I have to search for the correct command line syntax.

Today I decided to simplify that process and created a little PowerCLI function to simplify this task. The function I created is called Rescan-VMHost and accepts an ESX host name or host object as input parameter.

Rescan-VMHost ESX01

The function also accepts host names or host objects from the pipeline. The optional -IncludePeers switch rescans all hosts in the given ESX host’s cluster additionally.

Get-VMHost ESX01 | Rescan-VMHost -IncludePeers

As an extra bonus feature the function also accepts a cluster object as input parameter and will rescan all ESX hosts in the given cluster.

Get-Cluster CL01 | Rescan-VMHost

Pretty cool huh?
I’ve already used this little function a lot and hope you find a use case for it too.

One last thing. Although the title of this post might suggest that this function works on ESXi only, that is NOT the case. The function will work on both ESXi and ESX, but since VMware decided to go solely with ESXi and refers to it as the VMware vSphere Hypervisor, I decided to follow that path and hence the post’s title.

function Rescan-VMHost {
  Performs a rescan operation on a specified ESX host or cluster
  This function rescans an ESX host or it's complete cluster when the -IncludePeers parameter is specified.
  Author: Arnim van Lieshout,
  Specifies the hostname, host object or cluster object to perform the rescan operation on.
.PARAMETER IncludePeers
  Specifies that all the hosts in the host's cluster should be rescanned instead of only the host itself.
  PS> Rescan-VMHost ESX001
  PS> Get-VMHost ESX00* | Rescan-VMHost -IncludePeers
  PS> Get-Cluster CL01 | Rescan-VMHost

	Param (
		[parameter(valuefrompipeline = $true, mandatory = $true,
		HelpMessage = "Enter an ESX(i) entity")]

	process {
		switch ($Entity.gettype().name) {
      		"String" {
				if ($IncludePeers) {Get-VMHost -Name $Entity | Rescan-VMHost -IncludePeers}
				else {Get-VMHost -Name $Entity | Rescan-VMHost}
      		"VMHostImpl" {
				if ($IncludePeers) {
					foreach ($VMHost in Get-Cluster $Entity.Parent | Get-VMHost) {
						$VMHost | Get-VMHostStorage -RescanAllHba
				else {
					$Entity | Get-VMHostStorage -RescanAllHba
      		"ClusterImpl" {
				foreach ($VMHost in $Entity | Get-VMHost) {
					$VMHost | Get-VMHostStorage -RescanAllHba
      		default {throw "No valid object type for parameter -VMHost specified"}

PowerCLI Book Update

As you might know, I was asked to co-author a PowerCLI book. Now that the book is nearly finished we posted an update on our book’s website at www.powerclibook.com.  If you’re interested in what will be covered in the upcoming book called “VMware vSphere PowerCLI Reference: Automating vSphere Administration” (Yes, I know it’s a mouth full, but I didn’t made the title) view the book’s table of contents on our book’s website.

This upcoming valuable resource (at least that’s what we think) is written by:

If you want to receive the latest updates on our book, make sure you subscribe to the PowerCLI book’s RSS feed.

You can already pre-order the book on various online bookstores. Secure your first edition collector’s item now!

ESXi Tech Support Mode

As a security recommendation you should always disable Tech Support Mode (TSM) on your ESXi servers, but sometimes it’s helpful if you’re able to connect to your ESXi server using Secure Shell (SSH). When you want to enable TSM, you have 3 options: 

  1. Use the Direct Console User Interface (DCUI)
  2. Use the vSphere Client
  3. Script it (using PowerCLI for example).

Enabling TSM using the DCUI

  1. Connect to the server console of your ESXi host.
  2. At the DCUI screen (Alt-F2) of the ESXi host, press F2 and provide credentials when prompted.
  3. Select Troubleshooting Options and press Enter.
  4. If you want to enable local TSM, select Enable Local Tech Support and press Enter. This allows you to login using the local console (ALT-F1) of the ESXi host.
  5. If you want to enable remote TSM, select Enable Remote Tech Support (SSH) and press Enter. This allows you to login to the ESXi host via SSH.
  6. Optionally you can configure a timeout that specifies the availability of TSM. After the timeout expires, TSM will be disabled again. Active sessions won’t be terminated however. To specify a TSM timeout:
    1. Select Modify Tech Support timeout and press Enter.
    2. Enter the desired timeout value in minutes and press Enter.
  7. Press Esc three times to return to the main DCUI screen.

Continue reading →

Brocade Network Advisor Management Plug-in for VMware vCenter

The storage network administrator drew my attention to the Brocade Network Advisor (BNA) Management Plug-in for VMware vCenter.

Brocade Network Advisor

Brocade Network Advisor provides a unified network management solution across Brocade Fibre Channel SANs, Fibre Channel over Ethernet (FCoE), Layer 2/3 IP switches and routers, Wireless, Layer 4/7 Application Delivery networks and Multiprotocol Label Switching (MPLS) networks. It provides a consistent user interface along with custom views and controls based on users’ areas of specialization. For more information have a look at the Brocade site or view the solutions brief

Management Plug-in for VMware vCenter

The management plug-in for VMware vCenter displays SAN connectivity information for managed ESX server hosts and switch port statistics in the vSphere client. It’s implemented as a web application hosted on the BNA Management server. This web application sends dynamic HTML content to the vSphere client and the client renders the HTML content.

  • SAN connectivity information of each virtual machine across all managed ESX hosts of the vCenter server.
  • Switch or AG port statistics of the switch to which the host is directly connected.
  • End-to-end (EE) monitor statistics (collected by EE monitors on the switch).
  • SAN events based on Fabric OS events displayed in the vSphere client. These events include a crossed threshold at the switch or AG ports for transmit or receive percent utilization as well an adapter port logging out of the fabric.

The VMware vCenter plug-in is supported on:

  • ESX 4.0 and ESX 3.5
  • vCenter 4.0 and later
  • Plug-in will support managing ESX hosts with adapters from following vendors:
    • Brocade Communications
    • Q-Logic
    • Emulex

Please note that the management plug-in for vCenter is only available in the BNA Professional and Enterprise products. After reading more info on the Brocade website, we decided to give it a try, but the problem was that we didn’t find any download available. Also consulting our Brocade contacts didn’t brought a solution. Digging through BNA’s documentation, we found out that the VMware vCenter management plug-in isn’t a separate download, but already integrated in BNA.

Continue reading →

ESXCLI the PowerCLI way

When trying to perform a Round Robin (RR) test on my vSphere 4.1 environment, I needed to know the number of paths available to the luns of the test servers. I also needed to change the Path Selection Policy (PSP) for the luns to Round Robin (VMW_PSP_RR). I could have done this easily using the VI client, but this must be done on a per device basis and remember the golden rule of scripting: “Whenever you need to do a task more than once, script it!” 

Changing the multipath policy on the command line is normally done using the esxcli command. Reading the release notes of PowerCLI 4.1.1 a while back, I noticed that there was a new cmdlet available called Get-EsxCli. This was the perfect opportunity to give that cmdlet a try and see what it’s capable of. 

Before you read any further, please notice that the Get-EsxCli cmdlet is experimental. Also notice that in order to retrieve an esxcli instance you have to be connected directly to an ESX host. 

Retrieving and using an esxcli instance

You can retrieve an esxcli instance using: 

$esxcli = Get-EsxCli

You now have access to the esxcli instance using the $esxcli variable. Normally on the command line you would use the command “esxcli nmp paths list” to list all the paths that are claimed by the Native Multipath Plugin (NMP). In PowerCLI this is similar: 


If you want to list the paths of only a specific device, you can narrow down the output by specifying the device as a parameter to the list() method.


Continue reading →

A 2nd year has passed

A 2nd year has passed, and this means another happy blogiversary to me!

Although there hasn’t been much writing activity on my blog for the past half of the year, the traffic rather shows a slight increase. Apparently there must be something valuable on my blog, as new visitors keep coming. Thank you!

The good news is that there’s a very good reason why my blogging activity is at a very low level at the moment. In July 2010, I was asked to become a co-author of a soon to be released book on PowerCLI.

For me 2010 was quite an eventful year, both negative and positive. Not only have I lost my manager and very close friend, but I also lost my father just one week after that. I still can’t believe they’re gone, but as always; life goes on.

On the other hand 2010 was also a year of joy and happiness. In March, I won the 3rd prize in VMware’s Script-O-Mania contest. You can find my submission here. An improved version of this function will be available in the book. On top of that, later this year I was designated as a vExpert2010 (Have a look at my vExpert2010 page for a list of vExperts). Who would have believed that! In July, as I already mentioned I was asked to co-author a book. In this opportunity I’m working together with these scripting experts: Luc Dekens, Alan Renouf, Jonathan Medd and Glenn Sizemore. That was something I dreamed of before, but never considered possible. But, by far, my most impressive event in 2010 was the birth of our third son!

While the PowerCLI book is progressing, I will slowly get more time on my hands and will try to pick up writing blog articles again. I hope you’re still with me and join me on my third year as a blogger!

Rests me nothing else than wishing you all Happy Holidays,  Merry Christmas and a prosperous 2011!

A new PowerCLI release and a New Year’s feature

On Decembre 2nd, VMware released PowerCLI 4.1.1 (or PowerCLI 4.1 Update1 as VMware calls it). Although this is a minor release, it contains more than just some bugfixes. The new release contains several enhancements and quite a couple of new cmdlets. Let’s have a look at some of the new improvements in PowerCLI 4.1.1:

  • Using the ESX CLI and ESX Top features of VMware vSphere. (experimental)
  • Working with distributed switches and distributed switch port groups.
  • Supporting SCSI controllers.
  • Querying and modifying vCenter Server alarms.
  • Managing advanced vCenter Server settings and Cluster HA advanced options.
  • Waiting for VMware Tools of the specified virtual machines to load.
  • Querying information about disk and disk partitions of hosts.
  • Formatting host disk partitions.
  • Querying the primary HA cluster nodes.
  • Zeroing out virtual machine hard disks.

For more information on changes made in vSphere PowerCLI 4.1.1, see the full vSphere PowerCLI Change Log.

New Cmdlets

The new cmdlets introduced in this release are:

New Year’s Feature

The PowerCLI development team has built a new feature into the Connect-VIServer cmdlet. This new feature is accessible through the -Menu parameter on the Connect-VIServer cmdlet. Using this parameter will present you a list of recently connected servers and allows you to select the server to connect to. I think it’s pretty cool, but you have to be patient as this feature will NOT be available untill January 1st. ;)

There are already quite some resources available on this new PowerCLI release. Have a look at the resources below:

vCloud Director offerings are coming

During VMworld Europe 2010 in Copenhagen I had the opportunity to have a glimpse of the VMware vCloud Director (vCD). While back in 2009 VMware was only still introducing the foundation for cloud computing by releasing vSphere 4, now just one year later, they actually did it and provide the software to actually enable cloud computing.

After performing the vCloud Director labs, which where awesome and gave you a very good introduction to what the vCloud Director actually is capable of, I had second thoughts about this product. Don’t get me wrong, I think the product is great and is the first step into a completely different way of utilizing virtualization technology, but on the other hand this is also it’s problem. The vCloud Director is another abstraction layer, and requires a complete different view on how to use VMware virtualization solutions imho. If you, like most administrators today, are still trying to control the things under the hood, it’s becoming extremely complex. Is the world ready for letting go the control of vCenter Server and handing it over to the vCloud Director?

At the same time I was also wondering who would make use of the vCloud Director to provide cloud solutions to customers. Again I was thinking that it would still take some time before we could actually see a cloud offering based on VMware vCloud Director. But surprisingly I was contacted by William Craig from StratoGen recently that they are seeking experienced VMware users to join there StratoGen vCloud Beta Program, which is based on VMware vCloud Director. It looks like vCloud Director offerings are becoming a reality sooner than I thought.

StratoGen is a managed hosting company and VMware Service Provider Partner (VSPP), based in London UK, providing enterprise VMware hosting, managed server hosting, co-location and connectivity products all backed by a 100% uptime SLA. StratoGen will shortly be launching an exciting new cloud platform based on VMware vCloud Director. This breakthrough product offers a huge range of exciting features allowing you to build, deploy and manage your own private cloud using their class leading infrastructure.

If you are an experience VMware user and interested in joining their beta program, please read the original message below and remember that you need to dedicate some time to them.

Original message:

StratoGen are seeking experienced VMware users to join the StratoGen vCloud Beta Program which is based on VMware vCloud Director.

Beta testing is a crucial element in the cycle of our product releases, and we work closely with the VMware community to ensure our products are the best they can be. vCloud Director is a powerful but complex product and as such we are seeking experienced users to provide informed feedback on our product offering.

By participating in the program you will be provided with resources on our enterprise platform enabling you to build, deploy and manage virtual machines, vApps and networks using the StratoGen vCloud Director portal. You will be contacted on a periodic basis for feedback.

StratoGen is a leading VMware Service Provider Partner (VSPP) with an extensive cloud hosting platform based in London, UK.

If you would like to take part in the program please register at http://www.stratogen.net/products/vmware-hosting-vcloud.html