Any operations related to a guest Operating System, files and
processes are performed via the
GuestOperationsManager
managed entity, so we will use that in order to get a list of all
processes running in our Virtual Machine.

And here is the Python script that would perform this task.

from__future__importprint_functionimportpyVmomifrompyVim.connectimportSmartConnectdefmain():si=SmartConnect(user='root',pwd='password',host='vc01')# Credentials used to login to the guest systemcreds=pyVmomi.vim.vm.guest.NamePasswordAuthentication(username='guest_user',password='guest_password')# Get a view ref to all VirtualMachinesview_ref=si.content.viewManager.CreateContainerView(container=si.content.rootFolder,type=[pyVmomi.vim.VirtualMachine],recursive=True)# Pick up the first VMvm=view_ref.view[0]print("VM Name: {}".format(vm.name))# Get VM processesprocesses=si.content.guestOperationsManager.processManager.ListProcessesInGuest(vm=vm,auth=creds)# Print some process infoprint("Process name: {}".format(processes[0].name))print("Process owner: {}".format(processes[0].owner))print("Process PID: {}".format(processes[0].pid))if__name__=='__main__':main()