PowerCLI Reference

Get-VirtualNetwork

Synopsis

The cmdlet retrieves all virtual networks on a vCenter server system.

Syntax

Get-VirtualNetwork -Id <String[]> [-Server <VIServer[]>] [<CommonParameters>]

Get-VirtualNetwork [[-Name] <String[]>] [-Location <VIContainer[]>] [-NetworkType {Network | Distributed | Opaque}] [-NoRecursion] [-Server <VIServer[]>] [<CommonParameters>]

Related Commands

Detailed Description

This cmdlet retrieves all virtual networks that match the specified filters for each default connection to the vCenter server system or all specified connections in the -Server parameter.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
NameString[]Specifies the names of the virtual networks that you want to retrieve.falseFalse
IdString[]Specifies the IDs of the virtual networks that you want to retrieve.trueFalse
LocationVIContainer[]Specifies vSphere container objects that you want to search for virtual networks. This parameter accepts Folder and Datacenter objects.falseTrue (ByValue)
NetworkTypeNetworkType[]Specifies the network types of the virtual networks that you want to retrieve. The accepted values are Network, Distributed, and Opaque.falseFalse
NoRecursionSwitchParameterIndicates that you want to disable the recursive behavior of the command.falseFalse
ServerVIServer[]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 the Connect-VIServer cmdlet.falseFalse

Return Type

Zero or more Network objects

Notes

Examples

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

$networks = Get-VirtualNetwork

Retrieves all virtual networks on a vCenter server system.

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

$networks = Get-VirtualNetwork -Name 'VM*'

Retrieves all virtual networks whose names begin with 'VM'.

-------------------------- Example 3 --------------------------

$networks = Get-VirtualNetwork -NetworkType Distributed

Retrieves all distributed networks on the vCenter server system.

-------------------------- Example 4 --------------------------

$networks = Get-VirtualNetwork -Id 'network_id'

Retrieves a virtual network by Id.


Copyright © VMware, Inc. All rights reserved.