Get-VMNetworkAdapterPortId
Gets the VFP/VSwitch port ID.
Syntax
Get-VMNetworkAdapterPortId
[[-VMName] <String>]
[[-VMNetworkAdapterName] <String>]
[<CommonParameters>]
Description
The Get-VMNetworkAdapterPortId cmdlet gets the VFP/VSwitch port ID for a virtual machine or infrastructure port. This cmdlet also returns the friendly name of the virtual switch to which the port is attached and the port name.
Examples
Example 1: Get the port ID for a virtual machine network adapter
PS C:\> ($switchName, $portId, $portName) = Get-VMNetworkAdapterPortId -VMName "vm1" -VMNetworkAdapterName "VMAdapter"
Example 2: Get the port ID for an infrastructure port
PS C:\> ($switchName, $portId, $portName) = Get-VMNetworkAdapterPortId -VMNetworkAdapterName "HostAdapter"
This command gets the port ID for an infrastructure port, and then saves it to the specified variables.
Parameters
-VMName
Specifies the name of the virtual machine for which to retrieve the port ID.
Type: | String |
Position: | 0 |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-VMNetworkAdapterName
Specifies the name of the virtual machine network adapter for which to retrieve the port ID.
Type: | String |
Position: | 1 |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
None
Outputs
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈