Automation

 View Only
  • 1.  Faulting out when trying to use method retrieve properties.

    Posted Jul 05, 2010 10:18 AM

    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.



  • 2.  RE: Faulting out when trying to use method retrieve properties.

    Posted Jul 05, 2010 11:01 AM

    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