Virtual Machine Testing from the Command Line
InstallAware includes a command line virtual machine testing utility which you may use in batch files, automated build processes, or just plain from the command line. The utility is invoked as follows:
iavmtool.exe [/?] /t [/h] [/u] [/p] -options -cmd:<command <parameters>> /? Display command line help /t Host Type, required 1: VMware Workstation 2: VMware ESX/ESXi 3: Microsoft Hyper-V /h Host server name, required when connecting to a virtual machine server /u Server user account name, required when connecting to a virtual machine server /p Server user password, required when connecting to a virtual machine server Options: -VmName Virtual Machine name, designating the target virtual machine -Snapshot Snapshot name, from those available with the target virtual machine Commands: GetVms List the names of the virtual machines available on the virtual machine server GetSnapshots List the names of the snapshots available with the target virtual machine on Turn on the target virtual machine off Turn off the target virtual machine copy Copy specified file to the target virtual machine Mandatory copy Parameters (comma separated): a. Guest operating system user name b. Guest operating system password c. Host operating system source file path d. Guest operating system target path All mandatory copy command parameters must be supplied using the exact ordering above. run Run specified file inside the target virtual machine Mandatory run Parameters (comma separated): a. Guest operating system user name b. Guest operating system password c. Guest operating system file path All mandatory run command parameters must be supplied using the exact ordering above. Optional run Parameters (must be supplied after mandatory parameters): d. wait: Wait for completion, prepend with a comma when supplied e. Command line parameters, prepend with a space when supplied, must always be the last parameter
The command line virtual machine testing utility returns the following codes to indicate success/failure:
- 0: Operation completed successfully.
- 100: Operation failed
- 101: User cancelled operation
- 105: Access denied
- 106: Incorrect password
- 110: Unable to connect to host server
- 114: Guest command line error
- 115: Guest sevice failure ( only)
- 120: Guest not found
- 121: Guest state error
- 122: Snapshot not found
- 125: Guest or integration tools missing
- 140: Interactive user session missing
- 200: Invalid path
- 205: Path create error
- 210: File not found
- 211: Path not found
- 212: File access error
- 213: Invalid file or path name
Options
VmName
Refers to the virtual machine ID for a
virtual machine.Refers to the full path of the VMX file associated with the virtual machine for a virtual machine.
Snapshot
Refers to the snapshot ID for a
virtual machine.Refers to the snapshot name for a
virtual machine.Commands
GetVms
This command is only supported on VMX file paths, respectively, based on the platform being queried.
and platforms. It returns either the virtual machine IDs or theGetSnapshots
When used on a
platform, this command returns snapshot IDs, together with corresponding names, and snapshot ID's for parent snapshots. The returned list of snapshots is ordered by snapshot creation dates.When used on a
platform, this command returns user visible snapshot names as available in the target virtual machine. The returned list of snapshots is ordered by snapshot parents.copy
This command copies a file to a target virtual machine. A working login to the virtual machine guest operating system target is required to successfully complete the copy.
Example
iavmtool.exe /t 1 -VmName:MyVm -Snapshot:SnapOne cmd:copy testuser,password,"c:\betatesting\myapp.exe","c:\test"
This command waits for the completion of the copy process and returns an error code in the event of an error or failure. This command automatically creates the target guest operationg system path if it doesn't already exist. This command automatically turns in the target virtual machine if it is in a powered off state.
This command does not reset the target virtual machine snapshit once the copy process is completed, and the virtual machine is left powered on.
run
This command runs a program inside the target guest virtual machine operating system. The program to run must have already been copied to the target guest virtual machine operating system using the copy command. A working login to the virtual machine guest operating system target is required to successfully complete program execution.
Examples
iavmtool.exe /t 1 -VmName:MyVm -Snapshot:SnapOne cmd:run testuser,password,"c:\test\myapp.exe"
This example runs c:\test\myapp.exe inside the guest virtual machine operating system. It does not include any optional arguments to pass to the program and it does not wait for program completion.
iavmtool.exe /t 1 -VmName:MyVm -Snapshot:SnapOne cmd:run testuser,password,"c:\test\myapp.exe",wait
This second example runs c:\test\myapp.exe inside the guest virtual machine operating system. It does not specify any optional arguments to pass to the program. It does wait for program completion and returns the error code reported by the program.
iavmtool.exe /t 1 -VmName:MyVm -Snapshot:SnapOne cmd:run testuser,password,"c:\test\myapp.exe",wait "arguments"
This third example runs c:\test\myapp.exe inside the guest virtual machine operating system. It specifies optional command line parameters for the program being run. It does wait for the completion of the program being run, and returns the execution result.
The command automatically turns on the specified guest virtual machine if it is not already powered on. This command does not reset the virtual machine snapshot once it completes the run process, and the target virtual machine is left powered on.
Double quotes do not need to be escaped with this command, since commas are used as delimiters instead of double quotes.
Please enclose your entire command line parameter in double quotes if it contains more than one argument, or spaces in any one of its arguments.
VMware and Microsoft Hyper-V Virtual Machine Requirements
The following requirements apply to all
, , and virtual machines used with this tool:- Guest tools or integration tools must be installed in the guest operating system.
- The guest operating system must be on the same network as the host operating system.
- A password protected user account must be defined on the guest operating system for tests to be run under.
Supported Operating Systems
- Service Pack 3 or higher. :
- Service Pack 2 or higher. :
- : No service packs are necessary.
Supported Virtual Machine Platforms
- : and higher.
- : and higher.
: Versions 2.x and higher.
Microsoft Hyper-V Requirement
You must install the InstallAware
inside the guest operating system before using this tool.This tool is supplied inside your main InstallAware installation folder as Hyper-V.exe.
You may also manually undertake the following steps to configure your
virtual machines for use with the command line virtual machine testing utility without using the InstallAware :- Click regedit, and then press ENTER. , choose , type
- Locate and then select the following registry subkey: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System.
- If the LocalAccountTokenFilterPolicy registry entry does not already exist, then follow these steps:
On the menu, point to , and then choose .
Type LocalAccountTokenFilterPolicy, and then press ENTER.
- Right-click the LocalAccountTokenFilterPolicy value, and then choose .
In the data box, type , and then click OK.
Examples
iavmtool.exe /t 1 -VmName:MyVM cmd:copy guestUser,guestPassword,"c:\testing files\setup.exe",c:\temp\setup.exe iavmtool.exe /t 1 -VmName:MyVM -Snapshot:MySnap cmd:run guestUser,guestPassword,c:\temp\setup.exe iavmtool.exe /t 1 -VmName:MyVM -Snapshot:MySnap cmd:run guestUser,guestPassword,c:\temp\setup.exe,wait "parameter1 parameter 2" iavmtool.exe /t 1 -VmName:MyVM -Snapshot:MySnap cmd:run guestUser,guestPassword,c:\temp\setup.exe "parameter1 parameter 2" iavmtool.exe /t 1 -VmName:MyVM cmd:GetSnapshots
Notes
- The command line virtual machine testing tool is not available with the InstallAware Express edition.
- The command line virtual machine testing tool is not included in a minimum installation of InstallAware.