VMware Cloud Community
manfred9999
Contributor
Contributor
Jump to solution

VirtualMachine.PowerOnVM_Task how to get the Reference to the returned Managed Object - Task

Hello

I try to use the VirtualMachine.PowerOnVM_Task which returns a reference to the Managed Object - Task as ManagedObject Reference. (The VirtualMachine is the result of the get-view)

I use it in VB:

Dim refTask As Vim.ManagedObjectReference = Vim_VirtualMachine.PowerOnVM_Task(Vim_VirtualMachine.Runtime.Host)

I can get the reftask as ManagementObjectReference but from here I'm not sure how to convert it to the Managed Object - Task. I like to use all the properties and methodes of this Object.

Looking at my result of the refTask I don't find many properties......

Is it somhow possible to retrieve right object to have the reference to the taskobject.

Regards

Manfred

Reply
0 Kudos
1 Solution

Accepted Solutions
ykalchev
VMware Employee
VMware Employee
Jump to solution

Hi,

You can get managed object from it's Moref either using Get-View cmdlet or in VB using VimClient.GetView method i.e:

Get-View -Id refTask 

or

 Dim task As Vim.Task = Vim_VirtualMachine.Client.GetView(refTask)

Note that each MO has Client property that is of VimClient type.

Regards,

Yasen

Yasen Kalchev, vSM Dev Team

View solution in original post

Reply
0 Kudos
2 Replies
ykalchev
VMware Employee
VMware Employee
Jump to solution

Hi,

You can get managed object from it's Moref either using Get-View cmdlet or in VB using VimClient.GetView method i.e:

Get-View -Id refTask 

or

 Dim task As Vim.Task = Vim_VirtualMachine.Client.GetView(refTask)

Note that each MO has Client property that is of VimClient type.

Regards,

Yasen

Yasen Kalchev, vSM Dev Team
Reply
0 Kudos
manfred9999
Contributor
Contributor
Jump to solution

Hello Yasen

Great!

Thank you for the answer it solved my problem.

Regards

Manfred

Reply
0 Kudos