Created
June 12, 2015 14:59
-
-
Save pathcl/bcfc43b6b228936bed68 to your computer and use it in GitHub Desktop.
connect.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
vSphere Python SDK program for connecting a Vmware host | |
""" | |
import atexit | |
from pyVim import connect | |
service_instance = connect.SmartConnect(host='host', | |
user='user', | |
pwd='password', | |
port=int(443)) | |
atexit.register(connect.Disconnect, service_instance) | |
content = service_instance.RetrieveContent() | |
objview = content.viewManager.CreateContainerView(content.rootFolder, | |
[], | |
True) | |
esxi_hosts = objview.view | |
print esxi_hosts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment