May 7th, 2015 by JFrappier

Jonathan Frappier Virtxpert

The PowerCLI Cookbook by Phillip Sellers is an excellent resource for any skill level, whether you are a beginner or looking for a great reference to have with you.

PowerCLI Cookbook by Phillip Sellers

First and foremost, this book far exceeds what I expect out of a technology cookbook. If you step back and think about a (food) cookbook you get the recipe for what you are going to make (i.e. what you are going to do in PowerCLI) and the ingredients to make it (i.e. the cmdlets necessary to perform the task). Phillip took that a step further and began the cookbook with how to actually start the oven, or in this case a simple recipe to connect to vCenter and get started using PowerCLI.

The chapters in the book are laid out very well, starting with basic hosts related tasks, before moving on to vCenter, virtual machines, and other more complex scenarios – the build up in this format makes it excellent for those who are new to PowerCLI, or even VMware for that matter. Each recipie also has a “how it works” section where the components use are explained (no one has ever told me how food flavors work together!).

You could quite literally use the book to just about stand up a complete vSphere environment as all the major topics such as networking, datastores, clusters, and virtual machine management (including using PowerCLI to invoke in guest scrips) is covered.

**Disclaimer – I have a book published with Packt Publishing and spoke to Phillip before he decided to write the book. This book was provided to me by the author but the review was not read, or approved by Phillip, it is simply my opinion on the book and its contents.**

Yummy! – PowerCLI Cookbook Review by Phillip Sellers (@pbsellers)

Posted in Tech Tagged with: , , , , , , , , ,

November 13th, 2014 by JFrappier

Jonathan Frappier Virtxpert

That is a wrap on getting the basics of a home lab up and running in VMware Workstation.  Within Workstation we have a working Windows 2012 Domain Controller, two virtual ESXi hosts both capable of running nested 64-bit virtual machines thanks to the RVI support in the processor of the 8-core home lab system build and vCenter running.  In vCenter we have our datacenter and cluster created with both virtual ESXi hosts added.  The cluster has DRS enabled, a virtual distributed switch setup with both hosts attached and port group and VMkernel interface setup and running and demoed using vMotion to move a virtual machine from one host to another.  Not bad for 4 virtual machines barely consuming any memory on the host computer!

All that though, was leading up to this; setting up vRealize Automation and Application Services.  In my next series I will go over some of the basics of getting vRealize Automation setup in your home lab so you can start to get a feel for the various roles, requirements and setup.  Here is some handy reading in the interim (ignore anything that says vSphere SSO can’t be used)

Thank you for following along with the home lab series setup, I know there may be a few holes but again the goal was to get this setup to have an environment as the foundation to test other tools.

Workstation Home Lab Wrap-Up – On to vRealize Automation

Posted in Tech Tagged with: , , , , , , , , , , , , , , , , , , , , , ,

November 10th, 2014 by JFrappier

Jonathan Frappier Virtxpert

In the last post we looked quickly at importing the vCenter Server Appliance through the vSphere Client, however its high time we introduce PowerCLI.  PowerCLI is a set of PowerShell cmdlets to manage your VMware environments (vSphere, vCloud Director and View) and is quite powerful.  So powerful in fact that this is going to be a pretty short post, the 7 bullet points needed just to import the OVF through the vSphere Client is now a single command!

Launch PowerCLI as administrator and run the following to log in:

connect-viserver 192.168.6.11

Log in as root when prompted.

Now either change to the directory the OVF is located in or make note of the location for the cmdlet:

Import-VApp -source .VMware-vCenter-Server-Appliance-5.5.x.xxxxx-xxxxxxx_OVF.ova -VMhost 192.168.6.11 -DiskStorageFormat thin -name vxprt-vc01

Below you can see it in console as well as it happening if you were to log into the vSphere Client

PowerCLI Import-VApp progress

PowerCLI Import-VApp progress

View PowerCLI Import-VApp progress in the vSphere Client

View PowerCLI Import-VApp progress in the vSphere Client

1 command – how do you not love PowerCLI?  You can see all of the options available in the Import-VApp cmdlet in the PowerCLI documentation.  Now having shown you those options, I am actually going to run the VCSA in VMware Workstation, simply click File >> Open, select the OVF then provide a name and location.  Power on the VCSA and see my post here about configuring it.

Importing VCSA via PowerCLI – VMware Workstation Home Lab Setup Part 10

Posted in Tech Tagged with: , , , , , , , , , , , , , , , , , , ,

November 9th, 2014 by JFrappier

Jonathan Frappier Virtxpert

So had a need to clone a vApp several times, I finally got around to automating thanks again to PowerCLI.  A few things I had to consider; with the New-VApp cmdlet you cannot select portgroups so I had to do that after the vApp was clone and also needed to put the vApp into a specific folder after it was clone.  Otherwise, it was actually kind of easy to figure out based on what I needed to accomplish.  Here it is, in case you need to accomplish it as well :)

#Get vApp names and port groups
$CSVfile = "c:adminscriptsehc_vapps.csv"

# Set PowerCLI Options
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false | Out-Null

$EHC_vApps = Import-Csv -Path $CSVfile
ForEach ($EHC_vApp in $EHC_vApps)
{
#Creates new vApp
New-VApp -Name $EHC_vApp.name -Datastore $EHC_vApp.datastore -Location $EHC_vApp.cluster -VApp $EHC_vApp.template

#Get list of vApp VMs to set network card
$vApp_vms = Get-VApp $EHC_vApp.name | Get-VM
ForEach ($vApp_vm in $vApp_vms)
{
Get-VM -Location $EHC_vApp.name $vApp_vm | Get-NetworkAdapter | Set-NetworkAdapter -Portgroup $EHC_vApp.portgroup -Confirm:$false
}

#Move vApp to StudentPod folder
Move-VApp -Destination $EHC_vApp.folder -VApp $EHC_vApp.name
}

PowerCLI to Clone a vApp

Posted in Tech Tagged with: , , , , , , , , , , , , , , ,

November 8th, 2014 by JFrappier

Jonathan Frappier Virtxpert

So now we’ve got two ESXi hosts and our domain controller running in the home lab, it’s almost time to setup vCenter however, in a real world scenario you would need a way to get vCenter onto the ESXi hosts (because of course you are virtualizing vCenter).  Up until now what we have done through the DCUI would have been at a keyboard and mouse or virtual KVM (such as Cisco UCS or HP iLO) and we cannot create virtual machines via the DCUI.  So, what tools are available to manage our ESXi hosts to start creating virtual machines?

First, typically most people would start with the Windows vSphere Client.  This client can connect directly to an ESXi host and start creating virtual machines, such as a Windows virtual machine for vCenter or importing virtual appliances such as the vCenter Server Appliance (VCSA) which we will use in our lab set later on.  You can see all of my VCSA related posts below:

You can download the Windows vSphere client from the ESXi getting started page by navigating the IP address of one of your ESXi hosts (like was done in the last post at https://192.168.6.11).  If you are running Windows 8.x you will need to download a J++ package and install it before proceeding with the Windows vSphere Client, thanks to my friend Matthew Brender for reminding me of that gotcha which also means you will need to turn on the .NET Framework 3.5.  To do so, open the Start menu, go to Control Panel >> Programs and Features and click Turn Windows features on or off.  Tick the .Net Framework 3.5 box and click OK

enable-dotnet35-windows81

Once .NET 3.5 is enabled and J++ is installed, download the vSphere Client, run the installation wizard and log in to the IP address/host name of your ESXi host as root.

vSphere Client

vSphere Client

Another option is to install PowerCLI, which is based on PowerShell and very powerful with many options to manage both ESXi hosts, virtual machines and more.  Again download and run through the PowerCLI installation wizard, it will install a few additional componenets as part of the install.  Once installed launch PowerShell as administrator (even if you are logged in as an administrator) and run

Set-ExecutionPolicy RemoteSigned

You should now be able to launch PowerCLI and run

Connect-VIServer 192.168.6.11

You will be prompted for a username and password and are then connected and can run cmdlets in PowerCLI to import or create new virtual machines.

powershell-powercli

PowerShell Set-ExecutionPolicy and PowerCLI

Since we are using VMware Workstation, we can also use that to connect to the ESXi hosts (or a vCenter server later) as well.  In VMware Workstation, click on File >> Connect to server.  Enter the IP, username (root) and password to log in.  You can now create virtual machines on your virtual ESXi host running in VMware Workstation from VMware Workstation!

esxi-vmware-workstation

ESXi in VMware Workstation

In the next post, we will use the vSphere Web Client and PowerCLI to import the vCenter Server Appliance for our home lab which will provide (obviously) vCenter, Single Sign-On (SSO) and the vSphere Web Client which is where we will do most of the work through this series.

VMware Workstaion Home Lab Setup Part 7 – Management Tools

Posted in Tech Tagged with: , , , , , , , , , , , , , , , , , , , ,