def print_vm_info(vm, depth=1, max_depth=10):
 if hasattr(vm, 'childEntity'):
  if (depth > max_depth):
   return
  vmList = vm.childEntity
  for c in vmList:
   print_vm_info(c, (depth + 1))
  return
 summary = vm.summary
 print 'Name       : ', summary.config.name
 print 'Path       : ', summary.config.vmPathName
 print 'Guest      : ', summary.config.guestFullName
 annotation = summary.config.annotation
 if annotation:
  print 'Annotation : ', annotation
 print 'State      : ', summary.runtime.powerState
 if (summary.guest is not None):
  ip = summary.guest.ipAddress
  if ip:
   print 'IP         : ', ip
 if (summary.runtime.question is not None):
  print 'Question  : ', summary.runtime.question.text
 print ''

def print_vm_info ( vm , depth = 1 , max_depth = 10 ) : if hasattr ( vm , 'childEntity' ) : if ( depth > max_depth ) : return vmList = vm . childEntity for c in vmList : print_vm_info ( c , ( depth + 1 ) ) return summary = vm . summary print 'Name       : ' , summary . config . name print 'Path       : ' , summary . config . vmPathName print 'Guest      : ' , summary . config . guestFullName annotation = summary . config . annotation if annotation : print 'Annotation : ' , annotation print 'State      : ' , summary . runtime . powerState if ( summary . guest is not None ) : ip = summary . guest . ipAddress if ip : print 'IP         : ' , ip if ( summary . runtime . question is not None ) : print 'Question  : ' , summary . runtime . question . text print ''
print information for a particular virtual machine or recurse into a folder with depth protection .