Previous Topic: dpmhv-showVMSCSI (Funclet) Command--Show all SCSI ControllersNext Topic: CA IBM LPAR AutoShell Commands


dpmhyperv ShowVMs (Funclet) Command--Get all VMs

The dpmhv-showVMs command returns a list of VMs on a Hyper-V host server. The command gets the names and corresponding GUIDs of the specified VM.

This command has the following format:

dpmhv-showVMs 
-host hostname[-retval]
[-silent]
-host hostname

Specifies the name of the Hyper-V server host.

-retval

Returns a value for further processing.

-silent

Specifies not to direct the output to the screen.

Return Value

The dpmhv-showVMs command returns an array of objects representing the VMs on the specified host.

The objects include the following properties:

guid

Represents the unique ID of the VM.

name

Represents the display name of the VM.

Example: Get all VMs

This example returns a list of VMs and their corresponding GUIDs on the host, "hvserver."

dpmhv-showVMs 
-host hvserver

Example: Show VM Properties for all VMs

This example returns displays the properties of all VMs on the host, "hvserver."

a = dpmhv-showVMs -host hvserver -retval -silent
    for each(vm in a)
    {
      ?
      ? "VM:", vm.ElementName
      dpmhv-getVMProperties -host hvserver -vmid (vm.Name)
    }