dvSwitch scripting – Part 13 – Export/Restore Config

One of the exciting new dvSwitch features in vSphere 5.1 is the ability to export and restore a dvSwitch configuration. This new feature is only available through the vSphere Web Client.

On Hypervisor.fr, a blog you should have in your RSS reader, there were already posts on how to configure the dvSwitch healthcheck and how to do a dvSwitch configuration rollback from PowerCLI. But till now, as far as I know, there were no functions to provide the dvSwitch export/restore functionality.

dvSw-export-import

Time to make this useful functionality available for the “PowerCLI automation crowd” 😉

Continue reading dvSwitch scripting – Part 13 – Export/Restore Config

Work with E1000E NICs in PowerCLI

Now that Windows 8 and Windows Server 2012 are readily available , we all want to do some exploring. But if you want to automate the creation of some test VMs for this, you are in for a surprise.

The current PowerCLI 5.1 Release 1 doesn’t accept the E1000E NIC as a Type on the New-NetworkAdapter cmdlet. Users start hitting this limitation, as can be seen on this PowerCLI Community thread. You can go for the E1000, but why settle for less if you can easily script the use of the E1000E NIC from PowerCLI?

So even though Eric “the Scoop Meister” Sloof debunked the myth that the E1000/E1000E is faster than the VmxNet3, the E1000E is the default NIC type that vSphere gives you when you create a VM for a Windows Server 2012 or Windows 8 VM. Note that the E1000 apparently uses slightly more CPU resources than the E1000E. With the function in this post you can now automate this behavior.

Update November 17th 2012: In KB2006859 it seems to say that the VMXNET3 NIC doesn’t work with Windows Server 2012 or Windows 8. And there have been several blogs (including mine) that picked up this info. But after you apply the September 2012 patch to your ESXi servers, you can also use a VMXNET3 NIC for both Windows OS. See here and here for more info.

Thanks to reader alcapapower for drawing my attention to this (see his remark in the comments below).

Continue reading Work with E1000E NICs in PowerCLI

dvSwitch scripting – Part 12 – Find free ports

On the PowerCLI Community there was an interesting question about dvSwitches, portgroups and connecting VMs. Turns out you will need to provide a free port to connect a VM’s NIC to a portgroup on dvSwitch.
Since the solution is a nice follow up on my previous, somewhat lengthy post, called Variations on a port, I decided to create a short post on the subject in my dvSwitch series.

Update 3th March 2016: added test to capture portgroups with no VM connected to it

Continue reading dvSwitch scripting – Part 12 – Find free ports

Variations on a port

I got an interesting question from one of my co-authors of the PowerCLI Reference book. He was looking for a method to find the port used by a VM when connected to a portgroup on a dvSwitch.

Finding the answer to that question is not too difficult, once you know which property holds the value. But while writing and testing the script, I thought that this question would be a good opportunity to show several ways and methods that you have at your disposal in PowerCLI and PowerShell, to come to a solution.

Here it goes.

Continue reading Variations on a port

vSphere 5 Top 10 – NetIOC

Another post from our Dutch VMUG Event 2011 presentation. This time it’s about number 5 in the Top-10, Network I/O Control. This feature allows user-defined network resource pools and end-to-end QoS.

Note that this feature requires distributed Switches (dvSwitch). In fact I could have also written this post in my dvSwitch series with the title dvSwitch scripting – Part 10 – NetIOC.

Continue reading vSphere 5 Top 10 – NetIOC

dvSwitch scripting – Part 9 – Traffic Shaping

Another interesting feature of a dvSwitch is the ability to use bidirectional traffic shaping. Besides the outbound traffic shaping that is available on regular virtual switches, with the dvSwitches we can also have inbound traffic shaping. The traffic shaping is defined with the three known, classical values: average bandwidth, peak and burst size.

Recently there were some threads in the PowerCLI Community that asked how to do this with PowerCLI. Time to add this to our repertoire of PowerCLI dvSwitch functions.

Continue reading dvSwitch scripting – Part 9 – Traffic Shaping

dvSwitch scripting – Part 8 – Get and Set network adapters

One of the feature requests that came up in several emails I received for my dvSwitch series, was how to get and set the network adapters of virtual guests. In the current PowerCLI version the Get-NetworkAdapter and Set-NetworkAdapter cmdlets can not handle portgroups on dvSwitches.

That is why I created the following two functions, called Get-dvSwNetworkAdapter and Set-dvSwNetworkAdapter.

Continue reading dvSwitch scripting – Part 8 – Get and Set network adapters

dvSwitch scripting – Part 7 – Find portgroup/Change VLAN Id

In a comment on one of the previous dvSwitch posts, see dvSwitch scripting – Part 2 – dvPortgroup, Gert asked how he could check if a portgroup with a specific VLAN Id existed on a distributed virtual switch.

Since a function that allows you to search for a portgroup that meets specific requirements can be quite useful, I decided to create a new function to do just that.

Additionally I will show in this post how you can change the VLAN Id of a specific portgroup.

Continue reading dvSwitch scripting – Part 7 – Find portgroup/Change VLAN Id

dvSwitch scripting – Part 6 – Private VLAN

Another post in the dvSwitch series. This time I’ll tackle the creation and use of a private VLANs (PVLAN) on a dvSwitch.

For those that are not that familiar with PVLANs have a look at KB1010691, that article gives a good overview of the PVLAN concept. And there were several sessions during the last VMworld that talked about PVLANs. The most noteworthy being TA2525 VMware vSphere 4 Networking Deep Dive.

In short, PVLANs allows isolation for guests on a shared IP subnet.

Continue reading dvSwitch scripting – Part 6 – Private VLAN

dvSwitch scripting – Part 5 – Clone/pg to dvPG

An interesting question came up in the PowerCLI Community recently. Jason wanted to use a script from another thread where you could connect a NIC to a specific portgroup while cloning a new guest from a template.

The script didn’t work when the requested portgroup was on a dvSwitch. Enough of a reason for me to have another look.

Continue reading dvSwitch scripting – Part 5 – Clone/pg to dvPG