## PowerCLI Reference

# Get-NetworkAdapter

## Synopsis

This cmdlet retrieves the virtual network adapters available on a vCenter Server system.

Syntax

Get-NetworkAdapter [-Id <String[]>] [-Server <VIServer[]>] [[-VM] <VirtualMachine[]>] [[-Template] <Template[]>] [[-Snapshot] <Snapshot[]>] [-Name <String[]>] [<CommonParameters>]
Get-NetworkAdapter -RelatedObject <NetworkAdapterRelatedObjectBase[]> [<CommonParameters>]

Related Commands

Online version
New-NetworkAdapter
Remove-NetworkAdapter
Set-NetworkAdapter

Detailed Description

This cmdlet retrieves the virtual network adapters available on a vCenter Server system. The cmdlet returns a set of virtual network adapters assigned to the virtual machines, templates, and snapshots specified by the VirtualMachine, Template, and Snapshot parameters. At least one of these parameters must be provided. To specify a server different from the default one, use the Server parameter.

Parameters

Name | Type | Description | Required? | Pipeline Input | Default Value
--- | --- | --- | --- | --- | ---
VM | VirtualMachine[] | Specifies the virtual machines from which you want to retrieve virtual network adapters. | false | true (ByValue)
Template | Template[] | Specifies the templates from which you want to retrieve virtual network adapters. | false | true (ByValue)
Snapshot | Snapshot[] | Specifies the snapshots from which you want to retrieve virtual network adapters. | false | true (ByValue)
Id | String[] | Specifies the IDs of the network adapters you want to retrieve. Note: When a list of values is specified for the Id parameter, the returned objects would have an ID that matches exactly one of the string values in that list. | false | false
Name | String[] | Specifies the names of the network adapters you want to retrieve. | false | false
RelatedObject | NetworkAdapterRelatedObjectBase[] | Specify an object to retrieve one or more network adapters that are related to the object. This parameter accepts standard and distributed port groups. | true | true (ByValue)
Server | VIServer[] | Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer. | false | false

Return Type

Zero or more NetworkAdapter objects

Notes

Examples

-------------- Example 1 --------------

    Get-NetworkAdapter -VM MyVM

Retrieves the network adapters added to the the MyVM virtual machine.

-------------- Example 2 --------------

    $myVDPortgroup = Get-VDPortGroup -Name "MyVDPortGroup"
    $myNetworkAdapters = Get-NetworkAdapter -RelatedObject $myVDPortgroup

Retrieves all network adapters connected to the specified port group and stores them in the myNetworkAdapters variable.

Copyright © VMware, Inc. All rights reserved.