Suppose you want to run the antivirus software presented in Scan VMDK for Virus Signatures for all virtual machines hosted on a VMware Workstation. Here is the high-level algorithm for an VIX-based application that would scan hosted disk on all virtual machines.

To virus scan hosted virtual disk:

1

Write an application including both the Virtual Disk API and the VIX API.

2

Initialize the virtual disk library with VixDiskLib_Init().

3

Connect VIX to the Workstation host with VixHost_Connect().

4

Call VixHost_FindItems() with item-type (second argument) VIX_FIND_RUNNING_VMS.

This provides to a callback routine (fifth argument) the name of each virtual machine, one at a time. To derive the name of each virtual machine’s disk, append “.vmdk” to the virtual machine name.

5

Write a callback function to open the virtual machine’s VMDK.

Your callback function must be similar to the VixDiscoveryProc() callback function shown as an example on the VixHost_FindItems() page in the VIX API Reference Guide.

6

Instead of printing “Found virtual machine” in the callback function, call the DoVirusScan() function shown in Scan VMDK for Virus Signatures.

7

Decontaminate any infected sectors that the virus scanner located.