VMworld 2013: PowerCLI Best Practices – A Deep Dive #VSVC4944

My first scheduled session was with Alan Renouf and Luc Dekens, the PowerCLI gurus of VMware and always busy writing scripts and code to make the life of a VMware professional easier.

DSC03006

Alan Renouf and Luc Dekens slicing the PowerCLI cake.

During this session, Alan and Luc were sharing their best practices when using PowerCLI 5.5 Release 1 and PowerShell v3. I basically wrote down a list of these best practices and specifically the ones that come in handy during my activities. Hopefully it will come to good use for others.

  • Use tags (introduced in vSphere 5.1). Tags can be read and written, which was not possible in earlier releases of PowerCLI
  • vDS support. Now you can configure distributed switches
  • Open your VM console using PowerCLI and share the URL with administrators to enable them to directly login to the VM console without logging into vSphere Web Client.
  • vCloud Director 5.5 support
  • Configure ESXi host licenses
  • Make sure when processing data, that you filter the search before filtering the results to speed up the processing of your command or script.
  • Don’t use Write-Host, instead use Write-Verbose or Write-Warning
  • Use venter Alert Actions to automate in a very easy way. Let’s say after deploying a VM, you want to automatically run a script in the VM that installs AntiVirus software, or your CMDB gets updated automatically. There are numerous amount of alerts available in vCenter which you can use out-of-the-box
  • WebCommander, a VMware fling which presents PowerCLI scripts, for any kind of product (View, vCloud Director, vSphere etcetera) in a web-based view available to you, the scripter/programmer and also your users. It’s even possible to give users a direct link to your scripts. Looks like an App store for PowerCLI scripts 🙂
  • Check out PS-Remoting to re-use PowerCLI sessions open to your vCenter Server. This decreases load on your vCenter server and increases the speed of your scripts, since the initial load only happens once, when you open up the session.
WebCommander, a fling by VMware

WebCommander, a fling by VMware

Thanks to Alan and Luc for their session and dose of humour 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s