listDatastoreFiles.pl

Version 1

    This script lists the contents of a specific datastore on ESX(i) and all subsequent folders providing the fileName, owner, fileSize and the type of file. In the current form, the script is to be executed against a specific ESX(i) host, but can be extended to query against a vCenter host, I will leave that as an additional exercise for end users.

     

    Requirements:

    ESX(i) 3.5 or 4.0

    vSphere SDK for Perl or vMA 4.0

     

    Sample Execution:

    [vi-admin@scofield ~]$ ./listDatastoreFiles.pl --server esxi40-1.primp-industries.com --username root --datastore esxi40-1-local-storage
    Enter password:
    
    Name                                    Owner                                   Size                    Type
    vm-1                                     | root                              | 1.50 KB              | FolderFileInfo
    vm-2                                     | root                              | 980 Bytes            | FolderFileInfo
    vm-1.vmx                                 | root                              | 2.63 KB              | VmConfigFileInfo
    vm-1.vmdk                                | root                              | 0                    | VmDiskFileInfo
    vm-1.nvram                               | root                              | 8.48 KB              | VmNvramFileInfo
    vmware-1.log                             | root                              | 31.62 KB             | VmLogFileInfo
    vmware.log                               | root                              | 30.81 KB             | VmLogFileInfo
    vm-1.vmxf                                | root                              | 259 Bytes            | FileInfo
    vm-1.vmsd                                | root                              | 0                    | FileInfo
    vm-1-13e373e7.vswp                       | root                              | 1.00 GB              | FileInfo
    vm-2.vmx                                 | root                              | 1.73 KB              | VmConfigFileInfo
    vm-2.vmdk                                | root                              | 0                    | VmDiskFileInfo
    vm-2.vmxf                                | root                              | 259 Bytes            | FileInfo
    vm-2.vmsd                                | root                              | 0                    | FileInfo