-
Notifications
You must be signed in to change notification settings - Fork 0
Pivmomi
Pivmomi is a powerful python based tool for automation, and API access to VCenters massive suite of tools, and functions. Using this tool we can connect to a server, using an authenticated connection, and preform configurations and teaks via script or IDE.
To connect to a VCenter server, use tyhe following lines. This includes a bypass for SSL, and a TFL Version
import getpass
import ssl
from pyVmomi import vim
from pyVim.connect import SmartConnect
passw = getpass.getpass()
s=ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
s.verify_mode=ssl.CERT_NONE
si= SmartConnect(host=hostname, user=username, pwd=passw, sslContext=s)
Using the following script, linking to the "code" page of this repo, i was able to access my VCenter Server, grab and report session information, and provide a simple search, and reporting tool. Additionally the credential options for the connection are defined by 'creds.txt' file:
This lab was a pretty easy setup. The initial deliverables where quite straight forward using simple content paths, the hardest part was querying the name of the VM's into a list that i could search, and then retrieving the guest IP address took even more time that I did not expect.