VMware PowerCLI Hands-on-Learning Review

Have you been wanting to learn PowerCLI but don’t have a test environment to practice with out the fear of breaking live production? That is where this hands-on-learning (HOL) lab from VMware can come in handy.  I personally worked through this HOL and found that the information that was provide to be very thorough to help with beginners wanting to start with PowerCLI.  The other best part of this training is that it is free.

HOL-SDC-1607 From Beginner to Advanced Features with PowerCLI

This lab has an interface that provides a windows desktop with PowerShell with PowerCLI module installed.  Once you get it going you can either use the lab manual that is integrated into the interface or a provided PDF file so you can review the information at a later time.

Going through the lab manual it starts out slow and provides a lot of useful information, but I did notice that there was an issue when asked to opening the first script, Module7.ps1.  It seems as if there was an update to the script that they are asking for, but didn’t update the documentation to reflect the new script name.  The script that was needed, Module8.ps1, was located on the desktop of the lab computer.  The PowerShell script, Module8.ps1, that is asked to be open has the all of the commands that the lab manual references.

The first part of the course goes over how to get information about the VMs and how to export the data. It has several different ways to format the data; TXT, CSV, XML, and HTML.

Get-VM | Select Name, NumCPU, MemeoryMB, PowerState, VMHost | Out-File C:\MyPowerCLIReport.txt
PowerCLI_Txt
Results of Out-file saved as a txt file
Get-VM | Select Name, NumCPU, MemeoryMB, PowerState, VMHost | Export-CSV C:\MyPowerCLIReport.CSV -NoTypeInformation
PowerCLI_CSV
Results of export-csv
(Get-VM | Select Name, NumCPU, MemeoryMB, PowerState, VMHost | ConvertTo-XML -NoTypeInformation).Save("C:\MyPowerCLIReport.XML")
PowerCLI_XML
Results of ConvertTo-XML
Get-VM | Select Name, NumCPU, MemeoryMB, PowerState, VMHost | ConvertTo-HTML | Set-Content "C:\MyPowerCLIReport.HTML"
PowerCLI_HTML
Results of ConvertTo-HTML

The lab even went into creating a VM cluster and then how to configure DRS and HA. Then once the cluster is setup and configured,
it goes over how to move the hosts into the new cluster using command like the following:

Get-VMHost | Set-VMhost -State Maintenance
Get-VMHost | Move-VMHost -Destination $Cluster1
Get-VMHost | Set-VMHost -State Connected

The best part of this training in my mind, is that it goes over how to configure and setup a VDS (Virtual Distributed Switch). In my environment we have been working to re-configure all of our VM clusters to Distributed Switches.

$VDS = New-VDSwitch -Name "Production VDS" - Location "Primary DataCenter"

I thoroughly enjoyed taking this HOL lab and look forward to reviewing the next one:

HOL-SDC-1602 vSphere with Operations Management – Advanced Topics: Module 8 will introduce you to the new PowerCLI cmdlets for managing vRealize Operation Manager.

-Stuart

2 thoughts on “VMware PowerCLI Hands-on-Learning Review”

  1. Has VMware progressed to where I can ‘create’ a new VM on the fly?
    I’ve explored their VIX environment in the past and found that was the one big gaping hole in their otherwise excellent environment.

    Thank you.

    1. Hello Joe,
      If you have a template you can spin up a VM in a matter of a minute or less. Drop an IP on the box and you are ready to go. I have a script () that can be used to build multiple VMs at a time. The other option would be just doing a single VM in a single line via PowerCLI:

       New-VM -Name ServerName -Template TemplateName -ResourcePool (Get-Cluster $Cluster | Get-ResourcePool) -Location FolderName -OSCustomizationSpec OSSpec -MemoryGB 8 -NumCPU 4 

      I hope this answers your question.

      -Stuart

Leave a Reply

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