Suppose you want to run the antivirus software presented in Scan VMDK for Virus Signatures for all virtual machines hosted on an ESXi host. Here is the high-level algorithm for a VMware vSphere solution that can scan managed disk on all virtual machines.
To virus scan managed virtual disk:
Procedure
-
Using the VMware vSphere Perl Toolkit, write a Perl script that connects to a given ESXi host.
-
Call Vim::find_entity_views() to find the inventory of every VirtualMachine.
-
Call Vim::get_inventory_path() to get the virtual disk name in its appropriate resource.
The VMDK filename is available as diskPath in the GuestDiskInfo data object.
-
Using Perl’s system(@cmd) call, run the extended vixDiskLibSample.exe program with -virus option.
For ESXi hosts you must specify -host, -user, and -password options.
-
Decontaminate any infected sectors that the virus scanner located.