vCloud PowerCLI/PowerShell basics

In this blog I will introduce you to some of the basic functionality of using PowerCLI with vCloud.

Installing PowerCLI

The most recent version of VMware PowerCLI is available in the PowerShell Gallery so you can install the PowerCLI with one command:

And then load the module for vCloud:

When I loaded the module I ran into the following error message:

image

I fixed this by  changing the execution policy for running scripts in Powershell like so:

Do take note of the warning message when changing the policy and make sure you run Powershell as an administrator before running the above command.

Now that we have installed and loaded the module lets see what we got:

image

Please be aware that not all Cmdlets can be run as a Organization Administrator, some need to be run as vCloud administrator.

Now lets get started with some of the basics.

PowerCLI basics

Connect to you vCloud tenant

Enter your credentials when prompted and voila you are connected to your tenant.

Listing vApp’s and VM’s inside a vApp

Let’s starts with listing a vApp called ‘Test”’ and the VM’s within that vApp.


Listing vApp’s in a catalog

Now lets see if we can get some information about vApp’s stored in the vCloud catalog

*In a next blog post I will show you how to deploy a vApp from the catalog.

Ok now that we have used some basic commands lets turn it up a nudge and see if we can play around with a vApp network.

PowerCLI beyond the basics

Creating a Isolated network for a vApp

And if we look in vCloud we will find an isolated network with the name ‘MyVAppInternalNetwork’ has been created:

image

Of course, if you can add a network you can also remove it again:

So there you have it, PowerCLI and vCloud.

Please be aware that not everything can be done with PowerCLI, at some point you will need to start using the REST API for more advanced automation needs.

More info on vCloud REST API can be found here here https://code.vmware.com/apis/722

Check our other vCloud Director related articles here

134 total views, 6 views today

AboutArjen Kloosterman

Pre-Sales Consultant @ Uniserver Internet

Leave a Reply

Your email address will not be published. Required fields are marked *

*

code