How to setup govc to automate vSphere Tasks

This post is a long overdue tutorial on how to setup govc.

What is govc? It’s a cli utilizing govmomi, a go library used to interact with vSphere API. Why use govc? It’s fast and way better to use for automation tasks.


  1. Download release binary here:
  2. Depending on the platform, decompress:
    • gzip -d govc_linux_amd64.gz
  3. Flag it as executable
    • chmod +x govc_linux_amd64
  4. Move the executable to your $PATH:
    • mv govc_linux_amd64 /usr/local/bin/govc

How to use:

  1. Create a flat file with the below content
  2. source the file to export
  3. run govc
    • sample: govc ls

export GOVC_URL=
export [email protected]
export GOVC_PASSWORD=VMware1!
export GOVC_INSECURE=true

Advance examples here:


Leave a Reply


This site uses Akismet to reduce spam. Learn how your comment data is processed.