PowersHell: Enabling DPM Settings (IPMI/iLO/BMC)

In vSphere4 there’s a new method enabling the “Distributed Power Management” options for a DPM enabled cluster.

In vSphere4 there’s a new method enabling the “Distributed Power Management” options for a DPM enabled cluster. In the past you were dependent on the “wake-on-LAN” and so-called “magic packets” to suspend and resume an ESX host. In ESX4, you are able to configure a user on the iLO/IMPI/BMC/DRAC/RAC board and, with the right settings, get the ESX host to suspend and resume itself via the ACPI functionality which has been around for some years.

You can configure it in the GUI like so:

That’s all well and good I guess. I’ve recently been trying to port all my usual setup routines (commonly in my kickstart install scripts) to PowerShell. This is part of my preparation for getting ready for an ESXi only world where the days of esxcfg-commands will be long gone.

So how do you do this in PowerShell. Well, I was stumped for days on this even though I was VERY close. In fact, to this day, I really don’t see how my bad PS scripts didn’t work, and good one does work. I’ll just blame that on the ghost in my machine! In the end I was helped out by Stuart Radnidge of vInternals. I’m very grateful for Stu for sharing his PS script for DPM on the VMware Forums. That’s how I first started delving into the more murkier depths of the VMware SDK APIs. Stu has a very nice post explaining (for idiots/mere mortals like me) how deep into the SDK using PowerShell has your pick-axe. It’s called PowerShell Mastery - http://vinternals.com/powercli-mastery/.

Additionally, if you are into DPM the other thing Stu has shown, is how to create DPM user account on a HP ILO using the HP ILO command-line utilities. That means the entire job (create DPM using an ILO and configure on ESX host) can be scripted. Of course the tricky thing to script is getting a hold of the MAC address of ILO. I imagine you can do that with the HP ILO CLI commands…


Anyway, that’s the background. Here’s Stu’s DPM script.

I’ve slight modified it (no major surgery) so it matches the conventions used in other samples on RTFM…

$vmhost = “esx4.vi4book.com”
$login = “vmware_dpm_user”
$password = “password”
$hostview = get-vmhost $vmhost | % {Get-View $_.Id}
$IpmiInfo = New-Object Vmware.Vim.HostIpmiInfo
$IpmiInfo.BmcIpAddress = “″
$IpmiInfo.BmcMacAddress = “00:16:35:37:F8:02″
$IpmiInfo.Login = $login
$IpmiInfo.Password = $password


Since writing this, I think I’ve figured out why Stu’s script worked and mine didn’t. He was including | % {Get-View $_.Id} and I wasn’t (not sure if that was significant). Additionally, it seems to be the case that the ESX host must be added into vCenter first for the script to work. I found DPM didn’t have to be enabled on the cluster to allow the DPM configuration to go through.

Dig Deeper on Scripting administrative tasks