Posted by
Alan Renouf
Technical Marketing

Following my previous post where I showed how easy and quick it was to create a Provider VDC there was a step which we needed to complete before the Provider VDC would be available to use, if you took note of the last screenshot it looked the same as below:


The more attentive of you will have noticed the system alerts on the status, this is because we had not prepared the hosts within our cluster to be used with vCloud Director.  When first adding ESXi hosts to a VCD Provider VDC an agent is needed on the hosts, Chris Colotti explained recently what this agent was needed for here.

There are two ways to add this agent, the first is to include it in your ESXi Image, this is explained here and can also be used with Auto Deploy, if it is not pre-included in the ESXi build then it will need to be installed after the hosts have joined VCD.

To do this we can use the below script on each host in the Provider VDC:

Function Prepare-CIHost {
    Param (
    $Search = Search-cloud -QueryType Host -Name $CIHost
    $HostView = Get-CIView -SearchResult $Search
    $HostView.Prepare($password, $username)

Prepare-CIHost -CIHost "ESXiHost1" -Username "root" -Password "Pa$$w0rd"

There are a couple of interesting techniques in this simple script, use of the –SearchResult parameter in the Get-CIView cmdlet can be very handy, If you are looking into automating VCD with PowerCLI I suggest you look at this further.

Another cmdlet used in this script is the Search-Cloud, again a very useful cmdlet which allows you to find objects in the Cloud very fast.  More examples and details of the Search-Cloud cmdlet will be mentioned in a future post.

Get notification of new blog postings and more by following VMware PowerCLI on Twitter: @PowerCLI