Session: VIX Programming to Automate Virtual Machine Operations
The VIX Programming Lab for VMware Workstation and VMware Server will detail techniques for automating common virtual machines operations in test and development environments including power state, snapshots, file copy and command execution. A logical series of hands-on programming exercises reinforces concepts presented in short lectures. The session will progress through overview, installation, common operations in test / development and advanced concepts in the VIX API. Participants should be familiar with batch scripting, Perl, Visual Basic or C.
The instructor presentation, student lab manual and the completed code examples are included in the zip archive.
Note: For the C examples on Windows, please statically link with the following libraries:
VixAllProducts.lib (or VixAllProductsd.lib for debug)
Exercise 1 - Find Running VMs using vmrun, Perl and C
This example shows how easy it is to list and count the running VMs on Workstation 6 using the vmrun command line as well introduce the concepts of establishing a host connection, error checking and retrieving a list of running virtual machines.
Please see FindRunningVMs.bat, FindRunningVMs.pl and FindRunningVMs.cpp
Exercise 2 - Common Operations
These examples show how to affect power state changes, snapshots, file copies and command execution using vmrun, Perl, VBscript and C.
For VM power operations, please see Power.bat, Power.pl, Power.cpp and Power.vbs.
For snapshot operations, please see Snapshot.bat, Snapshot.pl, Snapshot.cpp and Snapshot.vbs
For file copy and command execution, please see UpdateBuild.bat, UpdateBuild.pl, UpdateBuild.cpp and UpdateBuild.vbs
Exercise 3 - Virtual Debugger
This lab demonstrated the VIX virtual integrated debugger using a simple C++ program with VisualStudio 2005.
Please see the IDE Demo project. This project is included for completeness only as it contains no VIX code.
Exercise 4 - Advanced Concepts
This example shows how to start and restart FreeCell in a virtual machine using vmrun, Perl, C and VBscript. FreeCell will restart if the user exits the game and the VM will power on if powered off. FreeCell starts again as soon as the user is logged in. Please use control C to stop the program.
Please see MonitorGuest.bat, MonitorGuest.pl, MonitorGuest.cpp and MonitorGuest.vbs