powercli

vCO Custom Workflow Icons

While at VMworld Europe 2014 I noticed in some of the slides in a vCO session that the presenter was using some icons for workflows that did not appear to be standard. I was quite curious how to do this, but couldn’t find much information about it until I stumbled on the below training video. If you don’t want to watch the video, here’s how to do it. Get your images into vCO Supported:

I'll be presenting some automation at the June 2014 South West VMUG

Those great guys down in the South West of England, @mpoore, @jeremybowman, @virtualisedreal and @simoneady have kindly invited me down to their next VMUG to present about automation. So I will be talking about some of my experiences in automation projects from the last few years and particularly how to write your own code in a generic way so that it is portable across different projects and systems. It looks like there is plenty of other good content lined up that day so I’d suggest you get down there too.

PowerCLI In The Enterprise: Breaking The Magician’s Code & Function Templates

At today’s #UKVMUG I presented on the topic: PowerCLI In The Enterprise: Breaking The Magician’s Code. Below are the slides from the session: During the session I discussed breaking your PowerShell code down into functions and modules. To aid with this I am posting the 6 function templates I use which cover many of the typical scenarios I write a function for and enable the rapid creation of these functions since much of the code is typically repeated.

Problems With VM After Failed Snapshot-Based Backup - Unable to Access File Since It Is Locked

Whatever backup solution you use to backup your virtual infrastructure with, you may sometimes end up with VM snapshots that need to be cleaned up. After a backup failure alert, I use the following PowerCLI one-liners to quickly identify and remove snapshots left behind (by say Netapp SMVI). Get-VM | Get-Snapshot | Where-Object {$\_.Name -like 'smvi\*'} | ft VM,Name,Created -AutoSize Get-VM | Get-Snapshot | Where-Object {$\_.Name -like 'smvi\*'} | Remove-Snapshot -RunAsync -Confirm:$false Recently I had an instance where post a backup failure the snapshot failed to remove with the error Unable to communicate with the remote host, since it is disconnected.

UKVMUG 21st Nov 2013 Community Session "PowerCLI Automation in the Enterprise: Breaking the Magician's Code"

The agenda for this year’s UKVMUG has been published and a pretty fine line up it looks too. What’s really great is that during each section of sessions, there’s a community slot with real world info from people working with VMware technologies at the coalface. You’ll be able to pick sessions from @sammcgeown @maishsk @etherealmind @rickyelqasem and me. I’ll be talking about some of my experiences of PowerCLI automation in the field and examples of how to break your code down to make it more flexible to use in different scenarios.

Storage vMotion Fails with VM Hardware Version 4

Having recently enabled Storage DRS in a vSphere 5.1 environment we began to see a lot of the following errors in vCenter: The device or operation specified at index ‘x’ is not supported for the current virtual machine version ‘vmx-04’. A minimum version of ‘vmx-06’ is required for this operation to succeed The host(s) running the VM(s) in question contained the error matched in this VMware KB article: [2009-07-10 14:13:41.632 F638BB90 info ‘vm:/vmfs/volumes/4a56e6c2-9319e3df-f1af-001e0bea4030/RVHOLS029/RVHOLS029.

Get-Credential No Longer Prepends Username With a Backslash in PowerShell v3

This one tripped me up earlier in the week, so thought it was worth sharing in case you hit the same issue sometime. In PowerShell v2 and earlier when using Get-Credential to save credentials into a variable and NOT using a full Windows domain credential, e.g. something like: instead of a more Windows style credential: then the resultant stored credential prepends a \ in front of the username: $cred = Get-Credential PS C:\\> $cred UserName Password -------- -------- \\root System.

Adding a Host to vCenter Fails Because of Time Issues

I recently experienced an issue adding a vSphere 5.1 host to vCenter while using the Add-VMHost cmdlet in PowerCLI. I’m pretty sure the same problem would have occured if I was using the GUI, but this work was for part of some automated deployment work. On a freshly baked ESXi 5.1 install one of the first tasks is to get it into vCenter. However, this was failing with what initially appeared to be a license issue, despite there being plenty of available licenses.

Clone a VM from a Snapshot using PowerCLI

A colleague asked me whether it was possible to clone a VM from a particular snapshot. Since there is no capability to do this via the GUI, I looked at what was possible via other means, i.e. PowerCLI. The vSphere API contains a Clone_VM task, which includes the ability to specify a snapshot to clone from in the VirtualMachineCloneSpec. So I put together the below New-VMFromSnapshot function to make this easy to do for a few different scenarios - it supports multiple snapshots to choose from, full and linked clones, and multiple destinations such as cluster, datastore, VM folder:

@LucD22 talks to @GetScripting About Becoming a PowerShell MVP And His Upcoming PowerCLI Book

We were fortunate enough to get a bit of a scoop on the latest episode of GetScripting . Not only did we have chance to talk to Luc Dekens about recently becoming a PowerShell MVP, but he also gave us a bit of a scoop about his upcoming new book (due out in 2014), vSphere Performance Reporting with PowerCLI . Hopefully they’ll change the cover typo by the time it gets printed :-)