Did you already try this ?
↧
Did you already try this Powershell Query license assignments in vSphere / ESX4 ?