Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'rbvmomi'
- credentials = { :host => "192.168.1.10", :user => "administrator@vsphere.local", :password => "vmware", :insecure => true }
- vim = RbVmomi::VIM.connect(credentials)
- datacenter = vim.rootFolder.childEntity.first # grab the first datacenter
- datacenter.hostFolder.childEntity # this will return an array of all the clusters in the datacenter
- cluster = datacenter.hostFolder.childEntity.first # grab the first cluster from the datacenter
- cluster.host # this will return an array of all the ESXi hosts in the first cluster
- host = cluster.host.first # grab the first host in the cluster
- host.config.network.vnic # display all the vnics on the host
- host.config.network.vnic.first.spec.ip.ipAddress # display the ip address bound the to first vnic on the host
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement