Following on from the previous posts in this series, this post will take us through the group discussion held at VMworld this year and expand on the items noted during the session.
This post will focus on what people in the session used PowerCLI for and also the various ways people used to launch the scripts.
The other posts in this series can be found below:
- Getting Started with PowerCLI
- PowerCLI Resources
- Launching and using PowerCLI
- Advanced tools and scripting
What were people using PowerCLI for?
- PowerCLI can be used to easily identify machines with snapshots and manage these snapshots on mass, easily remove the snapshots over a certain amount of days old or report on who created the snapshots, how long they have been around for and how much space they are using.
- PowerCLI can be used for finding attached drives, CD-Roms, Floppy drives, the kind of things that stop vMotion from working, in fact, did you know that this was the original use case for PowerCLI ?! My how it has grown!
- PowerCLI was being used to cross check information in a CMDB by direct access to the database or API to pull the information and relate it back to the VM, or maybe the other way around, take the VM or host information and store it into the CMDB for further info.
- PowerCLI can also be used to manage VMware View, many people in the discussion were using it to manage Pools.
- Deploy VMs, not just one but hundreds, with a single line of code PowerCLI can be used to instantly deploy VMs on mass.
- PowerCLI can be used to configure your hosts, obviously Host Profiles is easier to use in an enterprise environment and will take less maintenance but a good PowerCLI build script can go far.
How are people running PowerCLI scripts?
- PowerGUI is not just a script editor, it has a MMC style interface which runs PowerShell scripts underneath. There is a VMware PowerPack from Quest (or whoever owns them now) and also a community PowerPack with lots of great additions already in there.
- You can run PowerCLI from an Excel Macro, this is a great way to create a simple form with Excel cells for entry, then in the macro use the cells as input to run a PowerCLI script. Some of these can look great and be an easy way to allow others to use your scripts.
- Windows Task Scheduler can be used to schedule your PowerCLI scripts, tasks which need to run on a timed basis can be setup and forgotten, email output is a great way to pass off results at the end of a scheduled script.
- PowerCLI can be launched as part of a vCenter alarm, this is a great way to run scripts on a certain condition like a VM being created or a host being added to vCenter or maybe a datastore running out of space. Find out how here.
- Guest Scripts can be launched using the Invoke-VMScript cmdlet, this is great for reaching inside your VMs to further the automation or return results needed on the guest OS.
- WebCommander is a great fling that allows you to launch scripts at the single click of a button, check it out here.