Script to fetchAuditRecords

How to use pyVmomi SDK for vSphere 7.0U3 to fetchAuditRecords


  1. OSS pyVmomi is hosted in GitHub:
    The project's main page contains pointers to general instructions for public releases of pyVmomi SDK.
  2. Attached is the sample code,, that will fetch audit records from ESXi using the OSS pyVmomi SDK.


Install pyVmomi SDK

First, you'll need a functioning Python environment. This may differ by operating system and distribution.

  1. Inspect your system and determine if Python 3.5 or later is installed. If not, get the latest Python 3.x
  2. get pip (Note: see the package manager section)


You need the pyVmomi SDK module inside your pypath and then import the module in your Python code.

To install the pyVmomi PyPI package:

% pip3 install pyvmomi

(pip3 is for Python 3 or higher)

Or if there is an older version already installed:

% pip3 install pyvmomi -upgrade

Please check the pyVmomi samples for usage examples:



Make file executable (chmod +x

To get info on input parms:

% ~/tmp$ ./ --help
usage: Display locally stored audit records. [-h] --host HOST --password PASSWORD --user USER

optional arguments:
-h, --help show this help message and exit
--host HOST The IP address of the ESXi host
--password PASSWORD Password to log in with
--user USER User name to log in with

Run to talk to ESXi box:

% ./ --host IP_addr --user root --password ""


Sign in to be able to add comments.

Comments 0