Reputation: 375
I'm trying to rename a Network Adapter on a virtual machine in Hyper-V. I've read through the documentation on MSDN and the Set-VMNetworkAdapter
cmdlet has a parameter -Name<String>
which reads:
Specifies the name for the virtual network adapter. The cmdlet changes the name to the value that you specify.
Which suggests to me that I should be able to name a Network Adapter as whatever I put in for the String.
Yet when I try the line:
Set-VMNetworkAdapter -VMName 'CENTOS' -VMNetworkAdapterName 'Network Adapter' -Name 'eth0'
I get an error:
Set-VMNetworkAdapter : Cannot bind parameter because parameter 'Name' is specified more than once. To provide multiple values to parameters that can accept multiple values, use the array syntax. For example, "-parameter value1,value2,value3".
Am I misunderstanding the use of the -Name
parameter? Or am I simply misusing the CMDlet?
Upvotes: 3
Views: 3508
Reputation: 2494
Or you could use the "Rename-VMNetworkAdapter" cmdlet. :)
Rename-VMNetworkAdapter -VMName 'CENTOS' -Name 'Network Adapter' -NewName 'eth0' -WhatIf
Upvotes: 4
Reputation: 46730
If you look lower down from the documentation you are quoting you would see that -Name
is an alias for -VMNetworkAdapterName
. Therefore you are already trying to name it 'Network Adapter' in your code sample.
So the error is indeed correct in stating that the parameter is specified more than once.
Upvotes: 1