VCAP-DCA Objective 8.1 : Execute VMware Cmdlets and Customize Scripts Using PowerCLI
Knowledge
- Identify vSphere PowerCLI requirements
- Identify Cmdlet concepts
- Identify environment variables usage
Skills and Abilities
- Use VMRun to execute commands in a guest OS
- Install vSphere PowerCLI
- Install Update Manager PowerShell Library
- Use basic and advanced Cmdlets to manage VMs and ESX Hosts
- Use Web Service Access Cmdlets
- Use Datastore and Inventory Providers
- Given a sample script, modify the script to perform a given action
Tools
- vSphere PowerCLI Installation Guide
- vSphere PowerCLI Administration Guide
- Product Documentation
- vSphere PowerCLI commands
- vSphere PowerCLI Cmdlets
Notes
I am still learning when it comes to Powershell and have been compiling a list of resources at http://www.seancrookston.com/powercli/ as I discover them. One I found particularly useful was from virtualize planet. There is a set of guides that take you from the beginner level to someone who can play around a bit more and start utilizing Powershell to the fullest.
Additionally I highly recommend Trainsignal’s Powershell training, that comes as part of the first and second pro series. I still have some ways to go through the advanced topics in the second part of the pro series, but have found the first part to be an amazing resource when it comes to learning how to use Powershell and then apply that learning to automate more tasks in your environment. This training is led by Powershell guru Hal Rottenberg who also has authored a book on the topic if you are not familiar.
For full disclosure the link above to the Trainsignal training is an affiliate link.
Use VMRun to execute commands in a guest OS
- Install VMware VIX(Windows or Linux)
- VMware Tools must be installed in Guest O/S
- C:\Program Files (x86)\VMware\VMware VIX\vmrun.exe
- http://www.vmware.com/pdf/vix160_vmrun_command.pdf
- http://www.virtuatopia.com/index.php/Controlling_VMware_Virtual_Machines_from_the_Command_Line_with_vmrun#The_Basics_and_Syntax_of_vmrun
- http://blogs.vmware.com/vix/2008/12/managing-vm-guests-using-vmrun.html
- http://www.virtuallyghetto.com/p/vmware-vix_29.html
Install vSphere PowerCLI
- Both the download and documentation can be found at http://communities.vmware.com/community/vmtn/vsphere/automationtools/powercli?hl=en&rlz=&q=powercli&aq=f&aqi=g10&aql=&oq=&gs_rfai=
Install Update Manager PowerShell Library
- Pretty straight forward, You have two options here, standalone or as a plug-in.
Use basic and advanced Cmdlets to manage VMs and ESX Hosts
- Refer to the links above to learn and get a grasp on Powershell. They do a great job of taking you from your basic Cmdlets all the way to more advanced options. As I mentioned above the Powershell training from Trainsignal was great as it was video led and led me to play around a bit more. The guides from Virtualizeplanet are also very good in getting you to understand the basics.
Use Web Service Access Cmdlets
- vSphere PowerCLI Administration Guide pg 21
- The vSphere PowerCLI 4.0 list of cmdlets includes two Web Service Access cmdlets Get-View & Get-VIObjectByVIView
Use Datastore and Inventory Providers
- From pg 24-26
- The Datastore Provider (VimDatastore) is designed to provide access to the contents of one or more
datastores. The items in a datastore are files that contain configuration, virtual disk, and the other data
associated with a virtual machine.All file operations are case‐sensitive.
September 07, 2010
Sean Crookston
Tags: 

Thanks for the kind words.
Pingback: VCAP-DCA Section 8 Scripting & Automation – Follow-up