Home > Converter, PowerCLI, PowerShell > Automating Converter Enterprise jobs with PS

Automating Converter Enterprise jobs with PS

September 20th, 2009 LucD Leave a comment Go to comments

With VMware vCenter you get a feature-rich free product called VMware vCenter Converter. One of the things you can do with the Convertor product is to read disk images created by VMware Consolidated Backup and import them in a vCenter. In the current release the Convertor doesn’t come with any support for the PowerCLI automation tools but that doesn’t mean we can’t use the Convertor from our PowerShell scripts.In our environment we needed to be able to import VCB disk images of guests into our Disaster Recovery center, which is build around a number of ESXi servers, each using one or more local datastores . Since we do this at regular intervals (more than once !), we wanted to automate this process.

I2V-scriptThe Converter product comes with a number of DOS commands. We used the converter-tool command in our script. Looking at the syntax, we see that the command requires an XML file as input for the -jobsubmit parameter.

converter-syntax

The layout of the XML file is, afaik, not documented, but by looking at the generated XML files from successful Converter jobs it was not too difficult to deduce most of the required nodes and their attributes.

The script has some additional features:

  • The imported guests are connected to a specified portgroup. We use this to connect these guests to an isolated portgroup, so that an accidental start of the guest doesn’t cause any problems.
  • The name of the imported guests contains the time stamp. This allows us to generate unique names and allows us to clean up older imports.
  • The script has a very simple target selection algorithm. It looks for the ESXi server that has the most free disk space on it’s local datastore.
  • The generated XML file, which is used for the Converter job, is saved for reference.

The script shows a very specific case of using the Converter from a PowerShell script, but I’m sure it can easily be adapted for other types of Converter jobs. Enjoy !

  1. oleg
    January 15th, 2010 at 20:10 | #1

    Great outstanding stuff!!!

    But let me ask you few questions…

    Where should I see the generated XML files from successful Converter jobs? I was going to use it as help (I need to import VM form one VC to another), but could not see any xml files anywhere…

    Also, any advices for script that will import VM from one VC to another will be really appreciated.

    Thank a lot!

    • January 15th, 2010 at 21:52 | #2

      Thanks Oleg.
      The XML files created by the Converter jobs can be found in C:\Documents and Settings\All Users\Application Data\VMware\VMware Converter Enterprise\jobs on a Windows 2003 server.
      On a Windows 2008 server that would be C:\ProgramData\VMware\VMware Converter Enterprise\jobs.

      In the XML file you have the “source” and “dest” sections.
      With those you should be able to connect to both Virtual Centers.
      If you do one job with the Converter GUI you should be able to see in the XML file how the parameters have to provided.
      Luc.

  2. September 21st, 2009 at 10:06 | #3

    Very cool

  3. Wade H.
    September 20th, 2009 at 23:37 | #4

    Great stuff Luc!

  1. September 21st, 2009 at 01:19 | #1
  2. September 21st, 2009 at 01:33 | #2