VDPort Category | Vmware PowerCLI Reference

VD Port Category

Cmdlets are usually implemented around resource operations. The four basic operations are CREATE, READ, UPDATE and DELETE. This set of operations is known as CRUD. Most of the cmdlets support CRUD which are respectively cmdlets that start with the New/Get/Set/Remove cmdlet verbs but they also may have additional operations

Step 1: Retrieve a object by running a Get command

You can READ objects by using Get-VDPort cmdlet. See example below:

# Retrieves a virtual distributed port assigned with a key named "MyPortgroupKey" from a virtual distributed port group named "MyVDPortgroup".

Get-VDPortGroup "MyVDPortgroup" | Get-VDPort -Key "MyPortgroupKey"

Step 2 : Run commands from the CRUD group

You can CREATE objects by using New-VDPortgroup cmdlet. See example below:

# Creates a new distributed port group on the specified vSphere distributed switch with the specified number of ports and VLAN ID.

Get-VDSwitch -Name "MyVDSwitch" | New-VDPortgroup -Name "MyVDPortGroup" -NumPorts 8 -VLanId 4
You can UPDATE objects by using Export-VDPortGroup cmdlet. See example below:

# Exports the configuration of the specified port group to the specified file.

Get-VDPortGroup -Name 'MyVDPortGroup' | Export-VDPortGroup -Destination 'C:\MyVDSwitchesBackup\MyVDPortGroup_21122012.zip'
You can REMOVE objects by using Remove-VDPortGroup cmdlet. See example below:

# Removes the specified distributed port group from the vSphere distributed switch that it belongs to.

Get-VDPortGroup -Name "MyVDPortGroup" | Remove-VDPortGroup

Step 3: Explore More Related Commands:


Get-VDPortgroup This cmdlet retrieves distributed port groups.
Get-VDPortgroupOverridePolicy This cmdlet retrieves the policy for overriding port group settings at port level.
Set-VDPort This cmdlet modifies the configuration of virtual distributed ports.
Set-VDPortgroup This cmdlet modifies the configuration of distributed port groups.
Set-VDPortgroupOverridePolicy This cmdlet modifies the policy for overriding port group settings at port level.