vcenterpyvmomi

How to fetch vCenter version using API?


I want to fetch the vCenter version for my project using API, tried with the pyvmomi python library. But I could not the vCenter version, eventhough I'm able to get ESXi and VM related information.

Version info in the vCenter UI


Solution

  • from pyVim.connect import SmartConnect
    
    con = SmartConnect(host="172.1.1.1", user="", pwd='')
    
    print(con.RetrieveContent().about.version)
    
    
    
    
    
    (vim.AboutInfo) {
      dynamicType = <unset>,
      dynamicProperty = (vmodl.DynamicProperty) [],
      name = 'VMware vCenter Server',
      fullName = 'VMware vCenter Server 6.7.0 build-18485185',
      vendor = 'VMware, Inc.',
      version = '6.7.0',
      build = '18485185',
      localeVersion = 'INTL',
      localeBuild = '000',
      osType = 'linux-x64',
      productLineId = 'vpx',
      apiType = 'VirtualCenter',
      apiVersion = '6.7.3',
      instanceUuid = '1f7fc3f0-2b79-4f99-8d0a-44be5fdf2021',
      licenseProductName = 'VMware VirtualCenter Server',
      licenseProductVersion = '6.0'
    }