GoVC

Name: VMware vCenter Server

Vendor: VMware, Inc.

Version: 5.5.0

Build: 4180647

OS type: linux-x64

API type: VirtualCenter

API version: 5.5

Product ID: vpx

UUID: F11B7E48-056C-4E27-B538-5210E3C4E553

env

export GOVC_URL='https://<username>:<password>@<vsphere.ip>'

export GOVC_INSECURE=1 # disable cert check

export GOVC_DATACENTER=NY5

VCenter

get basic vCenter info

govc about

VM

rename VM to a new name

-k=true is to disable cert check

govc vm.change -vm <old name> -name <new name>

get VM info

govc vm.info <vm name>

destroy VM

govc vm.destroy <vm name>

output as JSON

govc vm.info -json hostname | python -m json.tool

Datacenter

govc datacenter.info -u <username>:<pw>@<vcenter host> -k=true

list all Datacenter paths

govc ls

/NY4/vm

/NY4/network

/NY4/host

/NY4/datastore

govc ls /NY4/vm

/NY4/vm/myhost1

/NY4/vm/myhost2

etc