Rename virtual machine network adapter with identical name
-
Tuesday, February 12, 2013 11:48 PM
My Virtual machine hosted on Windows 2012 Hyper V have 2 network cards :
Name IsManagementOs VMName SwitchName
---- -------------- ------ ---------- ----------
Network Adapter False VM1 LAN1
Network Adapter False VM1 LAN2I would like to rename one of the network card to be able to assign to one of the network card a VirtualSubnetID.
The Rename-VMNetworkAdapter command don't made the difference with my 2 cards because they have the same name :
Rename-VMNetworkAdapter -name "Network Adapter" -vmname "VM1" -NewName "Network Adapter 2 "-id "Private Mutualia" -vmname "ff1.cesia.fr" -NewName "Private Mutualia2"
How can i rename only one network adapter ?
Tks for your help !
All Replies
-
Wednesday, February 13, 2013 7:03 AMModerator
Hi,
What’s the OS version of your Virtual Machine? Is the Virtual Machine installed with a Server Core Edition?
Can you modify the virtual machine adapter name through user interface?
If these virtual adapters have same name, network adapter rename operation apply to the two Virtual adapters. In my opinion, I think network adapter has same name is not allowed, so maybe there is something wrong. You may remove one Virtual network adapter, and then rename the rest one. After that, add a new virtual network adapter and rename it.
For more information please refer to following MS articles:
Rename-VMNetworkAdapter
http://technet.microsoft.com/en-us/library/hh848517.aspx
Remove-VMNetworkAdapter
http://technet.microsoft.com/en-us/library/hh848565.aspx
Add-VMNetworkAdapter
http://technet.microsoft.com/en-us/library/hh848564.aspxLawrence
TechNet Community Support
-
Wednesday, February 13, 2013 10:26 AMMy vm is a windows 2008 r2. Hyper-v is installed with the graphical interface. There is no way to rename a hyper-v network adapter with the graphical interface. I don't want to rename the network card inside the vm but only the name displayed on hyper-v. Network adapter with the same name are allowed. You can add with hyper-v 10 network cards, the 10 network card will have the same name but a different guid. There is no way to rename identical network adapter with rename-vmnetwork adapter. I can't uninstall my network card in my vm because its a forefront tmg with many network card.
-
Wednesday, February 13, 2013 1:36 PM
Actually, Hyper-V VMs can have up to 12 NICs, but that is not pertinent.
You can rename based upon MAC address. Below is a segment of PowerShell code where I am passing in a table with desired name ($ucsa.name) and MAC address ($ucsa.addr). I match the MAC address and then rename to the matching name. I also have passed in the name of the server I want to work on ($srvr)/
ForEach ($UcsA in $UcsAdapters) { $NICindex = (Get-WMIobject Win32_NetworkAdapterConfiguration -namespace "root\CIMV2" -computername $Srvr | Where-Object {$_.MACaddress -eq $UcsA.Addr}).Index $NIC = (Get-WMIobject Win32_NetworkAdapter -computername $Srvr | Where-Object {$_.Index -eq $NICindex}) If ($NIC.NetconnectionID -ne $UcsA.name) { $NIC.NetconnectionID=$UcsA.name $NIC.Put() } }.:|:.:|:. tim
- Marked As Answer by Lawrence LvMicrosoft Contingent Staff, Moderator Tuesday, February 19, 2013 2:36 AM

