## PowerCLI Reference

# Get-VDSwitch

## Synopsis

This cmdlet retrieves vSphere distributed switches.

Syntax

Get-VDSwitch [[-Name] <String[]>] [-Location <FolderContainer[]>] [-VMHost <VMHost[]>] [-VM <VirtualMachine[]>] [-Tag <Tag[]>] [-Server <VIServer[]>] [<CommonParameters>]
Get-VDSwitch -Id <String[]> [-Server <VIServer[]>] [<CommonParameters>]
Get-VDSwitch -RelatedObject <VDSwitchRelatedObjectBase[]> [<CommonParameters>]

Related Commands

Online version
Remove-VDSwitch
New-VDSwitch
Set-VDSwitch
Export-VDSwitch

Detailed Description

This cmdlet retrieves vSphere distributed switches.

Parameters

Name | Type | Description | Required? | Pipeline Input | Default Value
--- | --- | --- | --- | --- | ---
Name | String[] | Specifies the names of the vSphere distributed switches that you want to retrieve. | false | false
Id | String[] | Specifies the IDs of the vSphere distributed switches that 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. | true | false
Location | FolderContainer[] | Specifies vCenter Server container objects that you want to search for vSphere distributed switches. This parameter accepts Datacenter and Folder objects. | false | true (ByValue)
RelatedObject | VDSwitchRelatedObjectBase[] | Specifies an object to retrieve one or more vSphere distributed switches that are related to the object. This parameter accepts NetworkPool and OMResource objects. | true | true (ByValue)
Server | VIServer[] | Specify the cloud servers on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-CIServer. | false | false
Tag | Tag[] | Returns only the vSphere distributed switches that are associated with any of the specified tags. | false | false
VM | VirtualMachine[] | Specifies virtual machines to retrieve vSphere distributed switches they are connected to. | false | true (ByValue)
VMHost | VMHost[] | Specifies hosts to retrieve vSphere distributed switches to which the hosts are added. | false | true (ByValue)

Return Type

Zero or more VDSwitch objects

Notes

Examples

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

    Get-Datacenter -Name MyDatacenter | Get-VDSwitch

Retrieves all vSphere distributed switches in the specified datacenter.

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

    Get-VMHost -Name MyVMHost | Get-VDSwitch

Retrieves all vSphere distributed switches to which the specified host is added.

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

    Get-VM -Name MyVM | Get-VDSwitch

Retrieves all vSphere distributed switches to which the specified virtual machine is connected.

Copyright © VMware, Inc. All rights reserved.