Rename-VMNetworkAdapter

Rename-VMNetworkAdapter

Renames a virtual network adapter on a virtual machine or on the management operating system.

Syntax

Parameter Set: VMName
Rename-VMNetworkAdapter [-VMName] <String[]> [-NewName] <String> [-ComputerName <String[]> ] [-Name <String> ] [-Passthru] [-VMNetworkAdapterName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ManagementOS
Rename-VMNetworkAdapter [-NewName] <String> -ManagementOS [-ComputerName <String[]> ] [-Name <String> ] [-Passthru] [-VMNetworkAdapterName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ResourceObject
Rename-VMNetworkAdapter [-VMNetworkAdapter] <VMNetworkAdapterBase[]> [-NewName] <String> [-Passthru] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: VMObject
Rename-VMNetworkAdapter [-VM] <VirtualMachine[]> [-NewName] <String> [-Name <String> ] [-Passthru] [-VMNetworkAdapterName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

The Rename-VMNetworkAdapter cmdlet renames a virtual network adapter on a virtual machine or on the management operating system.

Parameters

-ComputerName<String[]>

Specifies one or more Hyper-V hosts on which the virtual network adapter is to be renamed. NetBIOS names, IP addresses, and fully-qualified domain names are allowable. The default is the local computer — use “localhost” or a dot (“.”) to specify the local computer explicitly.

Aliases

none

Required?

false

Position?

named

Default Value

.

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ManagementOS

Specifies that you want to rename a virtual network adapter that belongs to the management operating system.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Name<String>

Specifies the existing name of the virtual network adapter.

Aliases

VMNetworkAdapterName

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-NewName<String>

Specifies the new name for the virtual network adapter.

Aliases

none

Required?

true

Position?

3

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Passthru

Specifies that an object is to be passed through to the pipeline representing the virtual network adapter to be renamed. This is a Microsoft.Virtualization.Powershell.VMInternalNetworkAdapter object, if ManagementOS is specified; otherwise it is a Microsoft.Virtualization.PowerShell.VMNetworkAdapter object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VM<VirtualMachine[]>

Specifies the virtual machine that has the virtual network adapter you want to rename.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-VMName<String[]>

Specifies the name of the virtual machine that has the virtual network adapter you want to rename.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VMNetworkAdapter<VMNetworkAdapterBase[]>

Specifies the virtual network adapter to be renamed.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-VMNetworkAdapterName<String>

Specifies the existing name of the virtual network adapter you want to rename.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before running the cmdlet.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • None by default. If –PassThru is specified, then a Microsoft.Virtualization.Powershell.VMInternalNetworkAdapter object is passed through to the pipeline if -ManagementOS is also specified; otherwise a Microsoft.Virtualization.PowerShell.VMNetworkAdapter is passed.

Examples

Example 1

This example renames all the virtual network adapters of virtual machine Redmond to CoreNet.

PS C:\> Rename-VMNetworkAdapter –VMName Redmond –NewName CoreNet

Example 1

This example renames the virtual network adapter Private to CoreNet in virtual machine Kirkland.

PS C:\> Rename-VMNetworkAdapter -VMName Kirkland –Name Private -NewName CoreNet