KBI 311735 New CLI: Free Utility To Automatically Create Hundreds Of VMware Guests

Version

Argent Automated VM Maker CLI# 1902-A

Date

Tuesday, 12 February 2019

Summary

Using Argent’s proprietary Rule of 100, Argent often tests on hundreds of VMware guests

Creating hundreds or thousands of these guests is a odious and tedious chore

As this is often the case for Argent customers as well, Argent has created this free, free-standing CLI to automatically generate dozens or hundreds of VMware guests

This CLI employs PowerCLI to deploy and configure Guests in VMware

This KBI explains how to use this free command line interface from Argent

Technical Background

Creating VMware guests manually is time-wasting donkey work

For most of the development and operational environment, creating a virtual machine using code has become an industry standard

That is, manage and provision the infrastructure through software rather than doing it manually

This is referred to as Infrastructure as Code (IaC)

With Argent Automated VM Maker CLI multiple Guests can be created from a single OVA file

Steps to create Open Virtual Appliance package (OVA) is explained in a later section of this KBI

Steps To Create OVA File

The Argent Automated VM Maker CLI does the following

  • Creates VMware guests
  • Sets a range of IP addresses to the newly created guests
  • Sets subnet mask
  • Sets default gateway
  • Enables ping

The Argent Automated VM Maker CLI can be used to design and effortlessly deploy an entire virtual network of hundreds of machines

In addition to the above-mentioned functionalities, the Argent Automated VM Maker CLI can also:

  • Optionally override with precise IP to specific VMware guests
  • Optionally override user name and password (other than the values in OVA) to the VMware guests

Minimum Hardware And Software Requirements Of The VM Host

Any server that supports virtualization with at least:

  • 16 GB RAM
  • PowerShell Version 4.0
  • VMware ESXi – Version 5.5.0
  • Windows 2008 R2 Operating System
  • VSphere Power CLI Version 5.5

Supporting Operating Systems Of Guest Machines

Argent Automated VM Maker CLI supports the following Operating Systems

  • Windows 2008 R2, represented by Argent Variable WINDOWS_2008_R2_64
  • Windows 2012 R2, represented by Argent Variable WINDOWS_2012_R2
  • Windows 2016, represented by Argent Variable WINDOWS_2016

Prerequisites To Run CLI

  • Install VSphere Power CLI Version 5.5
  • .NET Framework 4.5 or Above

Command Line Syntax

ARGENT_AUTOMATED_VM_MAKER_CLI#.exe uses three mandatory command line arguments

ARGENT_AUTOMATED_VM_MAKER_CLI# /INPUT = Input file name ^

                                 /OVA = Template OVA file to deploy ^

                            /OVA_TYPE = Type of OVA file

It also displays the usage information with the following arguments

ARGENT_AUTOMATED_VM_MAKER_CLI# /HELP

ARGENT_AUTOMATED_VM_MAKER_CLI# /?

/INPUT = Input File

Input file is an Argent standard plain text file

It holds the details of the VMware server on which the Guests are to be deployed, OVA and guest machines

A detailed explanation of the INPUT file with an example is given in the following section Details Of INPUT file

/OVA = Path of the Virtual Machine Template (OVA) file

This argument is the path of the OVA file

Guests are created and deployed from this template file

/OVA_TYPE = Argent Variable Indicating the Operating System of the OVA

Based on the Operating System exported in OVA file, this CLI supports the following three types

  1. WINDOWS_2008_R2_64
  2. WINDOWS_2012_R2
  3. WINDOWS_2016

Note:

As it is required to store passwords of VMware server and OVA template machine in the input file, this CLI also has a provision to encrypt a password and write into a text file

To encrypt the password, following syntax is used

ARGENT_AUTOMATED_VM_MAKER_CLI#.EXE /ENCRYPT_PASSWORD = Password to encrypt ^

          /OUTPUT = Output file to write the encrypted password

How To Run

  1. Download ARGENT_AUTOMATED_VM_MAKER_CLI#

    Download ARGENT_AUTOMATED_VM_MAKER_CLI#_1902_A.zip

  2. Copy ARGENT_AUTOMATED_VM_MAKER_CLI#_1902_A.ZIP to C:\
  3. Extract the zip file using ‘Extract here’, which will create a folder in C drive with name ARGENT_AUTOMATED_VM_MAKER_CLI#_1902_A
  4. Edit input file in C:\ ARGENT_AUTOMATED_VM_MAKER_CLI#_1902_A\BIN

    A detailed explanation of the INPUT file with an example is given in the following section Details Of INPUT File

  5. Edit the CMD file in ‘C:\ ARGENT_AUTOMATED_VM_MAKER_CLI#_1902_A\CMD’

    There are the following files for different Operating Systems

    • $RUN_ME____MAKE_VM_WINDOWS_2008_R2_64____run_as_Admin.cmd
    • $RUN_ME____MAKE_VM_WINDOWS_2012_R2____run_as_Admin.cmd
    • $RUN_ME____MAKE_VM_WINDOWS_2016____run_as_Admin.cmd

    Choose the right CMD and edit the path of OVA file and save the CMD file as shown in the figure below

  6. Execute the edited CMD file with ‘Run as administrator’ privilege
  7. Wait for the application to complete

For ease of use and to make it error free one execution of the application is limited for one OVA

That is, One CMD = one OVA

Three Operating Systems: three OVA, three input files and three CMDs

Intermediate PowerShell Script Files

During the execution of this CLI, PowerShell Scripts are generated in the SCRIPT folder

These files are retained in the folder for later reference or use

An Excel file for debugging purpose is also created

Another PowerShell script named DELETE_ALL_VM is created which removes all the newly created Guests

Screenshots of Excel and Script are shown below

Deployment Details

Deployment details are logged in the log file as shown below


Details Of INPUT File

The input file has four sections namely,

  1. VMWare guest defaults, to specify the details of VMware Server on which the Guests are to be deployed
  2. OVA definition block to specify the credentials of machine from which the OVA file is exported
  3. IP definition block to specify IP address configuration for newly created Guests
  4. VM definition block to specify the name of the new Guests to be deployed

These sections are explained in detail below

VMWare Guest Defaults – Details Of VMware Server Required

This section of input file provide the following details of VMware server on which the guests are to be deployed

  • IP address of the VMware server
  • User name
  • Encrypted password of the user of VMware server
  • Data store name
  • Network name
  • Network type

OVA Definition Block – Details Of OVA File

This section of input file provide the details of machine from which the OVA file is exported

  • User name of the machine
  • Encrypted password of the user of the machine

IP definition block – Details Of IP Address Configuration

This section of input file is used to specify the IP address configurations such as, subnet mask, default gateway and IP address

There is also a provision to increment the IP addresses of subsequently created Guests

VM Definition Block – Name Of The guests To Be Deployed

This section contains the name of guests to be deployed

This section can also be used to override the default IP configuration specified in the IP Definition Block

A Sample Input File

/*

VMware guest defaults

*/

[VMWARE_SERVER]                         [192.168.102.10]

[VMWARE_USER]                           [root]

[VMWARE_PASSWORD_ENCRYPTED]             [{\131\175\148\200\203\202\205\204\207}]

[VMWARE_DATASTORE]                      [Esxi10ds]

[VMWARE_NETWORK_NAME]                   [VM Network]

[VMWARE_NETWORK_TYPE]                   [VMXNET3]

/*



OVA Definition Block

*/

[OVA_USER_NAME]                    [Administrator]

[OVA_USER_PASSWORD_ENCRYPTED]      [{\131\175\148\200\203\202\205\204\207}]]

/*

IP Definition Block

IP address configuration to be set on newly deployed VM

These are the default settings to be used for all VMWARE GUEST MACHINES

To override default values, configuration values must be mentioned under the vm name

*/

[IP_ADDRESS_SUBNETMASK]    [255.255.0.0]

[IP_ADDRESS_GATEWAY]       [192.168.101.1]

[START_IP]                 [192.168.70.1]

[INCREMENT_IP]             [2]

/*

VM Definition Block

Virtual machine names to be deployed

*/

[MACHINE_VM_NAME]           [MOTHER_0]

[MACHINE_VM_NAME]           [M1]

[MACHINE_VM_NAME]           [M2]

[MACHINE_VM_NAME]           [DE1]

/*

Override VM configuration of above VM (DE1)

Following configurations are used to configure DE1

*/

[VM_USER_NAME]                                       [USER_DE1]

[VM_USER_PASSWORD_ENCRYPTED]             [{\131\175\148\200\203\202\206\205\208}]]

[VM_COMPUTER_IP]                                     [192.168.80.1]

[VM_IP_ADDRESS_SUBNETMASK]                   [255.255.0.1]

[VM_IP_ADDRESS_GATEWAY]                         [198.162.101.1]

[MACHINE_VM_NAME]           [DE2]

[MACHINE_VM_NAME]           [DE3]

[MACHINE_VM_NAME]           [DE4]

[END]

      [END]

           [END]


Steps To Create OVA File


  • Create a virtual machine in VMware 5.5 Host with the following specification:

    Ram: 2 GB
    Hard Disk: 40 GB
    CPU: 2
  • Install Windows 2008 R2
  • Install VMware Tools – Very Important, OVA must have VMware Tools
  • Export the Virtual Machine as template (OVA file) as shown in the following figures

    Open vSphere Client and select the Virtual Machine to be exported as template

    Click “OK”, the template OVA file will be created in the specified directory

Resolution

Download and Install Argent Automated VM Maker CLI# 1902-A

If you need assistance please contact Argent Instant Help at help.Argent.com