VMware Cloud Community
priyawiz
Contributor
Contributor

Faulting out when trying to use method retrieve properties.

Hi All,

I have been trying this method since long time however is facing the issue now.

I am using this method to get the success or failure for a task performed.I am using PowerOffVM_Task and then by capturing the task ID of the VM am checking the status by using Retrieve properties.and recently am getting the following error could some one help on this.

“<faultstring>The request refers to an object

that no longer exists or has never existed.</faultstring>

I could find the update manager failed to update events on the respective ESX Host Hostd.log

Thanks

Priya.

Reply
0 Kudos
1 Reply
LucD
Leadership
Leadership

Since you didn't include any sample code, it's hard to determine what goes wrong.

I always use a construct like this

$vmName = <vm-name>
$vm = Get-VM -Name $vmName | Get-View

$taskMoRef = $vm.PowerOffVM_Task()

$task = Get-View $taskMoRef
	while("running","queued" -contains $task.Info.State){
	$task.UpdateViewData("Info")
}
$task.Info.State

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference