Get-VirtualNetwork

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.

Syntax

[-Location  <VIContainer[]>]
[-Name  <String[]>]
[-NetworkType  <NetworkType[]>]
[-NoRecursion]
[-Server  <VIServer[]>]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
optional
Location
VIContainer[] named
  • pipeline
  • Specifies vSphere container objects that you want to search for virtual networks. This parameter accepts Folder and Datacenter objects.
    optional
    Name
    String[] named
  • wildcards
  • Specifies the names of the virtual networks that you want to retrieve.
    optional
    NetworkType
    NetworkType[] named Specifies the network types of the virtual networks that you want to retrieve. The accepted values are Network, Distributed, and Opaque.
    optional
    NoRecursion
    SwitchParameter named Indicates that you want to disable the recursive behavior of the command.
    optional
    Server
    VIServer[] named Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null 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.

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

    Parameters

    Required Parameter Name Type Position Features Description
    required
    Id
    String[] named Specifies the IDs of the virtual networks that you want to retrieve.
    optional
    Server
    VIServer[] named Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null 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.

    Output

    VMware.VimAutomation.ViCore.Types.V1.Network.Network

    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.

    Related Commands

    Feedback

    Was this page helpful?