0

Is there a way do get the vsphere build versing using any API/SDK/REST?

I know it's possible using powershell on vcenter for that, but it'd be great if there was another option.

Like described here: https://www.virtuallyghetto.com/2017/08/powercli-script-to-help-correlate-vcenter-esxi-vsan-buildversions-wo-manual-vmware-kb-lookup.html

1
  • What version/s of vSphere are you looking to do this against?
    – Kyle Ruddy
    Mar 24, 2018 at 15:24

2 Answers 2

0

It looks like you should be able to using the VMware vSphere API Python Bindings, as you can just simulate going through the Managed Object Browser.

Parent Managed Object ID: ServiceInstance
Property Path: content.about

And then there is a build string which is what you are looking for.

0

I figure out how to do this, my need is having as much information about vsphere as possible, so get datacenter, cluster and host details is mantaroy.

For that I used the official ruby api, rbvmomi, but I believe it's exactly the same thing for python one and golang.

It's needed to interact through host folder under root/children object, which is not that clear on wmware api docs, to get it easier follow a piece of code:

vim = RbVmomi::VIM.connect host: host, user: 'user', password: 'pass', insecure: true, debug: false
vim.root.children.each do |root_child|
    root_child.hostFolder.children.each do |child|
        child.host.each do |host|
            prod = host.config.product
            puts host.name,                             
               prod.apiType,                     
               prod.apiVersion,                 
               prod.build,                           
               prod.fullName,                  
               prod.instanceUuid,             
               prod.licenseProductName, 
               prod.localeBuild,              
               prod.localeVersion,         
               prod.name,                           
               prod.osType,                      
               prod.productLineId,         
               prod.vendor,                       
               prod.version
        end
    end
end

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.