Forked from hartsock/datacenters_listing.py
Last active
August 29, 2015 14:24
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
from __future__ import print_function | |
from pyVim import connect | |
from pyVmomi import vim | |
si = connect.SmartConnect(host='vcsa', user='my_user', pwd='my_password') | |
content = si.RetrieveContent() | |
# A list comprehension of all the root folder's first tier children... | |
datacenters = [entity for entity in content.rootFolder.childEntity | |
if hasattr(entity, 'vmFolder')] | |
# Just to prove to ourselves we have that list: | |
for dc in datacenters: | |
print(dc.name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment