Previous Topic: dpmhv-getHostSwitches (Funclet) Command--Show Host Switches on a Hyper-V HostNext Topic: dpmhv-getJobStatus (Funclet) Command--Show Job Status


dpmhv-getJobInfo (Funclet) Command--Show Job Information

The dpmhv-getJobInfo command retrieves all the information pertaining to an asynchronous job such as completion percentage, error information, and start time.

This command has the following format:

dpmhv-getJobInfo 
-jobref job 
[-silent] 
[-retval] 
[-detail]
-jobref job

Specifies the job ID of an asynchronous job.

Note: Upon the complete execution of asynchronous job, Hyper-V holds the job information for few minutes (five) only, beyond which it becomes invalid.

-silent

Specifies not to direct the output to the screen.

-retval

Returns a value for further processing.

-detail

(Optional) Displays the information details of the asynchronous job.

Return Value

The dpmhv-getJobInfo command returns objects where each object represents the current job state.

Hyper-V Jobs:

The following properties are returned for local Hyper-V in regular mode:

The following properties are returned for local Hyper-V in detail mode:

Microsoft System Center Virtual Machine Manager (SCVMM) Jobs:

Properties returned for SCVMM in regular mode:

Properties returned for SCVMM in detail mode:

Example: Show Job Information

This example displays status of completion of an export job.

jref = dpmhv-exportVMEx -host hvserver -vm TestVM -dest c:\Ex-async
    do
    {
      sleep(5000)
      job = dpmhv-getJobInfo -jobref (jref) -silent -retval
      ? "Completion:", job.PercentComplete+"%"
    } while(job.ErrorCode==0 && job.PercentComplete<100)
    ? job.StatusDescriptions
    if(job.ErrorCode!=0)
    {
      ? job.ErrorDescription
    }

Example: Show SCVMM Job Information

This example displays the status of the completion of new VM created using an SCVMM template.

jref=dpmhv-createVMFromTemplate -host hvserver -vm NewVM -dest c:\VMs\NewBox -template Win2k3Clean -scvmmHost SCVMMLibSrv -async
    do
    {
       sleep(5000)
       job = dpmhv-getJobInfo -jobref (jref) -silent -retval
       ? "Completion:", job.ProgressValue+"%"
    } while(!job.IsCompleted)
    ? job.StatusString
    s = job.ErrorInfo;
    errorCode = parseInt(s.substr(s.lastIndexOf('(')+1).left(-1));
    if(errorCode!==0)
    {
      ? job.ErrorInfo
    }