vCenter Server on your AD Domain Controller?

Ok, so it’s not the most clever thing you can do, but in a lab situation you may not simply have the machines or licences to go around.

vmware tends to agree – the vCenter server itself wont normally install on a system where AD is running.

This product can only be installed on the following 64-bit operating systems:
Windows XP SP2 or above
Windows 2003
Windows 2008

The secret is to get vCenter to use different ports for its ADAM instance.

As I prefer scripting to clickity-click you can put in a default vCenter server build (with different LDAP ports) using

start-process -wait -filepath z:\vpx\VMware-vcserver.exe -argumentlist '/q /s /w /L1033 /v" /qr DB_SERVER_TYPE=Bundled FORMAT_DB=1 VCS_ADAM_LDAP_PORT=3899 VCS_ADAM_SSL_PORT=6369"'

You should install vCenter Server before promoting to AD. Once it’s done you can run dcpromo.exe to set up the AD.

Note: You wont be able to re-install the vCenter server though so the usefulness to you may vary. That’s right, this is not a recommended production deployment 😉

If you know what everything above is doing – great. If you don’t, then assume it will eat your children.


Storage vMotion only one harddisk via powershell

This is more a reminder to me 🙂

Get-HardDisk -vm vm | Where {$_.Name -eq "Hard disk 1"} |
% {Set-HardDisk -HardDisk $_ -Datastore "" -Confirm:$false}

But the summary is that it svMotions 1 hard disk out of a VM onto a different datastore – useful is you have multiple tiers and want say OS disk on one tier and low access data volumes on other storage tiers.

Automated VCenter install (lab)

I’m trying to keep my home lab pretty automated. One of the things i’m always (well occasionally 🙂 )trying out is new vCenter installs. In order to speed things up I have the following little powershell script to remove the vCenter Server application and the vCenter Client prior to automatically re-installing them.

This script below uses defaults for the install. It’s possible to completely script the install which is useful if you have a corporate standard configuration. All the details can be found here.

Anyway, here is the script – i’ve called it the totally imaginative name of resetvc.ps1 – don’t run it in your production environment unless you know what you’re doing

(get-wmiobject -computername . -class Win32_Product -Filter "NAME='VMware vCenter Server'" ).Uninstall()
(get-wmiobject -computername . -class Win32_Product -Filter "NAME='VMware vSphere Client 4.1'" ).Uninstall()
start-process -wait -filepath z:\vpx\VMware-vcserver.exe -argumentlist '/q /s /w /L1033 /v" /qr DB_SERVER_TYPE=Bundled FORMAT_DB=1"'
start-process -wait -filepath z:\vpx\VMware-viclient.exe -argumentlist '/q /s /w /L1033 /v" /qr INSTALL_VIUPDATE=1"'

Notes: First 2 lines uninstall the vCenter Server and the vSphere Client – just ignore the error messages if this is the first time you’ve installed the vCenter Server etc. The third line installs the vcenter server from the iso which for me is my z:. Lucky last, the vSphere Client is installed – including in this case the Host Update utility.

Administering vSphere using Perl – Introducing VSPP

Yes, I know you can use the vSphere Perl SDK and it’s ‘OK’ , however, as I wanted to a) learn more perl and b) learn more about the vSphere SDK I started playing with the idea of creating an abstraction layer on top of the vSphere perl SDK that provided perl functions similar in operation to the PowerCLI cmdlets available.

Why?  Well there is a) and b) above, but additionally there is c) because I can 🙂

I figured some of the code might be interesting to some so I created a project over at and i’m making the code available for anyone who wants it –  if no one does then that is OK as well.

The project is called VSPP (vsphere power perl) , yes you can tell I don’t work in marketing!  You can find the code via subversion at sourceforge.   It’s still pretty crude, no installable packages yet (or maybe ever).

Here’s an example piece of code (also in the svn repos) that Displays all the Hosts in a Datacenter using the VSPP api.

#!/usr/bin/perl -w

# DisplayHostsDatacenter: Display all the hosts in a specific datacenter
use strict;
use warnings;

use vspp;

my %opts = (
Datacenter => {
type => "=s",
help => "Datacenter name to display hosts for",
required => 1}

my $dcname=Opts::get_option('Datacenter');


my $dc = vspp::GetDatacenter( Name => $dcname ) ;
my $hosts = vspp::GetVMHost( Location => $dc );
print "Datacenter $dcname has " . scalar(@$hosts) . " hosts \nThey are :\n";
foreach (@$hosts) {
print $_->name . "\n";


And the output looks like this :

> ./ --server --Datacenter HomeDC
Datacenter HomeDC has 5 hosts 
They are :

This is ‘similar’ to what you would see in PowerCLI and considerably easier than using the vSphere SDK directly.

Anyway, enjoy.

Tidbit #2

  • Over at the Citrix Community Blog they continue their discussion about using powershell to mange XenDesktop.   To me, powershell is ok, and it’s really nice to see what is a dramatic improvement in windows scripting capability but when you’ve come from a Linux platform with the wealth of scripting languages available you struggle to be super impressed.  Don’t get me wrong powershell is a fantastic step forward for windows scripting.   That being said, a lot of virtualisation vendors are putting considerable effort into adding cmdlets for powershell to manage their hypervisors.  Those toolkits often aren’t available in equivalent form for Linux so even with the superior scripting possibilities you’re lacking the high level virtualisation constructs to wrap that wonderful scripting technology around.   There’s a definite trend to manage virtual infrastructure with powershell.  Personally, i’d prefer another option.
  • Oracle transforms SGE (Sun grid Engine) from free to 90 day evaluation.  It’s pretty sad, but Oracle is far better at making money than sun was so I can understand why they’re doing it.   I’m not sure the current user base is sufficiently cashed up to make the transition and I suspect most will look around for alternatives and only pay if they can’t find one.
  • Oracle released a white paper on Architectural Strategies for Cloud Computing
  • Citrix and HP produced an interesting whitepaper on Analyzing Citrix XenServer persistent performance metrics from Round Robin Database logs – it’s important to measure and monitor performance of your virtual infrastructure, you pay enough for it, make sure it’s performing properly 🙂
  • Something of interest to me is Google have finally released their chat client for Linux.  Am I still a second class google citizen because I run Linux?
  • Veeam released a lite (read as free) version of their reporter product
  • An excellent summary of The State of Open Source System Automation by Aleksey Tsalolikbin over at linux-mag is well worth a look if you want to understand the state of play for linux automation.
  • RHEV bug RHSA-2010:0627-01 DoS or possible privilege escalation on the host.  The geek in me wants to explore this a bit more – damn you free time, where are you.
  • Another excellent whitepaper on VMware vCenter Server Performance and Best Practices for vSphere 4.1 from vmware.
  • Great howto on Installing And Using OpenVZ On Ubuntu 10.04.   Openvz creates secure Linux containers.   If you’re only running a Linux workload and thinking about virtualising it then it’s worth a closer look.  Of course libvirt can manage openvz based linux virtualisation.

Tidbit#1 -Managing other peoples stuff with your tools.

Interesting things i’ve found this week and of course my comments.

vSphere OVF tool

Firstly, for those wondering what the OVF tool is then you can go here.

If you’re wondering what OVF is, well here is a good introduction. The short summary is the Open Virtualization Format (OVF) describes an open, secure, portable, efficient, and flexible format for the packaging and distribution of one or more virtual machines.

So how do you create an OVF file from a VM. It’s simple.

Select the VM you want to export in your vSphere client. Then using the File menu, select Export

Then it’s just a case of following your nose and saving the OVF export to somewhere with sufficient disk space.

At the end of the process you get this :

and the OVF export is complete. The exported contents look like this :

~/ovf$ ls
winxp-sp3-disk1.vmdk winxp-sp3.ovf

The mf file is a set of SHA1 hashes for the OVF and any of the VMDK files.
The ovf file is an xml file that attempts to describe the virtual machine in an independent/open format which is in theory importable into virtualisation products that fully support OVF files – I must try that 🙂

To display the OVF file you can run the ovftool in probe mode.

~/ovf$ ovftool winxp-sp3.ovf
Opening OVF source: winxp-sp3.ovf
OVF version: 1.0
Name: winxp-sp3

Download Size: 20.35 GB

Deployment Sizes:
Flat disks: 37.27 GB
Sparse disks: Unknown
Name: VM Network
Description: The VM Network network

Virtual Hardware:
Family: vmx-07
Disk Types: SCSI-buslogic

Completed successfully

To import the OVF you use a command like (the syntax for the vSphere locator is a bit odd – I highly suggest you read the OVF Tool Guide)

$ ovftool --powerOn --datastore=NFS1 winxp-sp3.ovf vi://
Opening OVF source: winxp-sp3.ovf
Please enter login information for target vi://
Username: geoff
Password: ********
Opening VI target: vi://geoff@
Deploying to VI: vi://geoff@
Disk progress: 1%

and on the VC you’ll see

Eventually you’ll get

Powering on VM: winxp-sp3
Completed successfully

Sure you can deploy from templates, but what if you have multiple environments in a variety of network locations and you’d like to have a common set of templates – enter the OVF. With a repository full of OVF’s accessible via http you can centrally store and distribute standard images out into all of your virtual environments.

Of course this is quite a simplistic example of creating/deploying from an OVF file. In the future maybe all application servers will be deployed from vApp appliances built with VMware Studio – do you really need systems administrators poking around on individually customized vm’s when in most cases they can be stateless appliances (well stateless apart from the configuration information used at deployment time). Something to ponder.