I needed this as well some time ago, probably for the very same reason. Did it this way.
import com.santaba.agent.groovyapi.esx.ESX
import com.vmware.vim25.mo.*
def host = hostProps.get("system.hostname")
def user = hostProps.get("esx.user")
def pass = hostProps.get("esx.pass")
def addr = hostProps.get("esx.url") ?: "https://${host}/sdk"
def svc = new ESX()
svc.open(addr, user, pass, 10 * 1000) // timeout in 10 seconds
def si = svc.getServiceInstance()
def rootFolder = si.getRootFolder()
// Get resource clusters
HostSystem esxHost = new InventoryNavigator(rootFolder).searchManagedEntities("HostSystem").first()
println "auto.vcenter.fullname=${si.aboutInfo.fullName}"
println "auto.vcenter.build=${si.aboutInfo.build}"
println "auto.vcenter.licenseproductname=${si.aboutInfo.licenseProductName}"
println "auto.vcenter.os.type=${si.aboutInfo.osType}"
println "auto.vcenter.product.line=${si.aboutInfo.productLineId}"
println "auto.vcenter.version=${si.aboutInfo.version}"
return 0