Change vnic type from / to e1000, Flexible, Vmxnet, EnhancedVmxnet, and Vmxnet3, and Unknown with Set-NetworkAdapter. UPDATED!

What if you noticed that your vms are running on wrong network card type ? Let’s say you want e1000 instead of vmxnet3 for some reason.There is a great cmdlet set-networkadapter. This will help us out in that kind of situation(Thx Rafael!).
Right, so what set-networkadapter can do for us ? (by this time you should read the get-help set-networkadapter -full). So now, like you already know 😉 it can do a lot for us! But what i want from it right now, is to help me with changing the adapter type. I want to change it from vmxnet 3 to e1000, would be cool if i will not need to shutdown vm too 😉 Unfortunately it will not be so cool at all !!! VM has to be powered off to make this change properly. Please do not do this while vm is up and running.
Continue reading

Advertisements

vmxnet3 Ethernet Adapter #2 #3 #4

So what to do when you add a vmnic vmxnet3 to vm and it results in having a network adapter with vmxnet3 Ethernet Adpater #2 or #3 for example. Well i tried many different workarounds, solutions but for some reasons they were not working for me. I visited around 10-20 different pages with ms,vmware kb and still it was not working.  For some reason my network cards were not on the list even if i used ms kb to see hidden devices as described here:

http://support.microsoft.com/kb/315539

How did i do it ? 🙂

First of all, let’s grab some knowledge about devcon.

http://msdn.microsoft.com/en-us/library/windows/hardware/ff544707%28v=vs.85%29.aspx

Download devcon tool. Make sure you use the right version on the system. If you are running for example w2k8r2 64bit you will not be able to remove hidden device. You will be able to list it though using

devcon.exe findall =net

It will show you hidden devices, but when you will try to remove it using 32bit devcon.exe nothing will happen 😉

I could not find standalone version of devcon.exe so i had to download the whole tools iso file from Microsoft.

http://www.microsoft.com/download/en/details.aspx?id=11800 => Windows Driver Kit

Open the iso file image and look for

GRMWDK_EN_7600_1.ISO\WDK\setuptools_x64fre.msi

GRMWDK_EN_7600_1.ISO\WDK\setuptools_x64fre_cab001.cab

Copy those 2 files to some test folder like c:\test1

Then extract the msi package ( some info about msi http://msdn.microsoft.com/en-us/library/windows/desktop/cc185688%28v=vs.85%29.aspx )

cd c:\test1

msiexec /a setuptools_x64fre.msi TARGETDIR=”C:\sth\x\y”

And grab fresh 64bit devcon from

c:\sth\x\y\winddk\7600.16385.win7_wdk.100208-1538\tools\devcon\amd64\devcon.exe

Copy the devcon.exe to the vm. If vm does not have any network use powercli for example.

Copy-VMGuestFile –LocalToGuest –Source C:\sth\x\y\winddk\7600.16385.win7_wdk.100208-1538\tools\devcon\amd64\devcon.exe –Destination c:\ -VM yourVM_NAME -GuestUser Administrator -GuestPassword “admin_password”

When connected to esxhost i believe you will have to use -HostUser <host user> -HostPassword <host password>  as well. I was doing this copy connected to vc via powercli.

Now run devcon.exe findall =net  if will print you the list with all network devices. In my case i found 2 which were not used and were causing the #2 #3 .

You will have to remove them all with: devcon.exe remove “@Your_unused_vmxnet_Device” , just copy/paste what’s on the left after executing devcon.exe findall =net regarding your vmxnet adapter.

Then repeat this step until will delete all of them. Reboot.

Now add the vmxnet3 adapter and see what happens 😉 Fresh clean nice and fluffy “vmxnet3 Ethernet Adapter” 🙂

By the way… If you want to have a template from which you will have a vm with clean vmxnet network adapter, then on the template make sure you have cleaned adapters using devcon, make sure that there are no vmnics added to that template vm. Shutdown the template vm. Then add a vmxnet3 network card. Save the vm as a template, and you can deploy vms from it. After vm will be deployed it will have a vmxnet3 network adapter without the #2 or #3 😉

I hope that this will save you a lot of time 😉