Previous Topic: dpmhv-showVMFloppy (Funclet) Command--Show the Properties of Floppy DriveNext Topic: dpmhv-showVMSCSI (Funclet) Command--Show all SCSI Controllers


dpmhv-showVMNICs (Funclet) Command--Show all Network Interface Cards

The dpmhv-showVMNICs command displays all Network Interface Cards (NIC) in the VM on a Hyper-V host.

This command has the following format:

dpmhv-showVMNICs 
-vm vmname|-vmid vmguid 
-host hostname 
[-retval]
[-silent]
[-detail]
-vm vmname

Specifies the name of the VM.

-vmid vmguid

Specifies the unique ID of the VM.

-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.

-detail

(Optional) Displays the details of the list of NICs.

Return Value

The dpmhv-showVMNICs command returns the objects.

The following properties are returned in regular mode:

The following properties are returned in detail mode:

Example: Show VM NIC Information

This example shows the information of the NICs of the VM, "TestVM" on the host "hvserver."

dpmhv-showVMNICs -host hvserver -vm TestVM
//Find virtual network the first adapter of a VM is connected To 
anic  = dpmhv-showVMNICs -host hvserver -vm TestVM -detail -silent -retval
lines = anic[0].Connection.split(",");
    for each(line in lines)
    {
      if(line.startsWith("SystemName="))
      {
        nsw = line.substr(11);
        nsw = nsw.trim('"');
        break;
      }
    }
    // Get switches
    asw = dpmhv-getHostSwitches -host hvserver -silent -retval
    // Find match
    for each(sw in asw)
    {
      if(sw.Name == nsw)
      {
        ?? "NIC",anic[0].ElementName
        ? " is connected to switch", sw.ElementName
      }
    }