Skip to content

Instantly share code, notes, and snippets.

@PatrickTerlisten
Created May 9, 2016 10:24
Show Gist options
  • Save PatrickTerlisten/006df05f1de3026b3110ef6001f2778a to your computer and use it in GitHub Desktop.
Save PatrickTerlisten/006df05f1de3026b3110ef6001f2778a to your computer and use it in GitHub Desktop.
Connect to vSphere using SmartConnect
import ssl
from pyVim.connect import SmartConnect
s = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
s.verify_mode = ssl.CERT_NONE
c = SmartConnect(host="192.168.20.1", user="root", pwd='Passw0rd', sslContext=s)
h = c.content.sessionManager.currentSession.key
print (h)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment