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.
Read more…
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.
Categories: 2011, Dutch, dvSwitch, NetIOC, PowerShell, VMUG, vSphere Tags: 2011, Dutch, dvSwitch, NetIOC, VMUG
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.
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.
Read more…
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.
Read more…
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.
Read more…
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.
Read more…
Over the last few weeks I have published a number of blog entries that showed how you could use PowerShell, PowerCLI and the SDK to automate the management of the vNetwork Distributed Switch.
To facilitate the use of the functions I provided in these posts I created a table that lists all the dvSwitch related functions together with a link to the post where they were published.
| Functionname |
Description |
Link |
New-dvSwitch |
Creates a new dvSwitch |
Part 1 |
Get-dvSwHostCandidate |
Find hosts that can be connected to a dvSwitch |
Part 1 |
Add-dvSwHost |
Add a host to a dvSwitch |
Part 1 |
Get-dvSwitch |
Find a dvSwitch by name |
Part 2 |
New-dvSwPortgroup |
Create a new dvPortgroup |
Part 2 |
Get-VLANRanges |
Internal function ! Do not use directlu. |
Part 2 |
Set-VM2dvPortgroup |
Connect a VirtualMachine to a dvPortgroup |
Part 2 |
New-InternaldvSwvNic |
Internal function ! Do not use directly. |
Part 3 |
New-dvSwConsole |
Create a Service Console on a dvSwitch |
Part 3 |
New-dvSwvmKernel |
Create a vmKernel on a dvSwitch |
Part 3 |
Set-dvSwPgvMotion |
Enable vMotion on a vmKernel dvPortgroup |
Part 3 |
Set-dvSwPgFTLogging |
Enable FT logging on a vmKernel dvPortgroup |
Part 3 |
Set-dvSwUplink |
Update the number of uplinks on a dvSwitch |
Part 4 |
Add-dvSwHostpNic |
Add pNics to a dvSwitch |
Part 4 |
Set-dVSwPgTeam |
Set up Nic Teaming on a portgroup on a dvSwitch |
Part 4 |
| <script> |
Clone a guest and connect to a dvPG |
Part 5 |
New-dvSwPVLAN |
Create PVLAN |
Part 6 |
Set-dVSwPgPVLAN |
Assign a PVLAN to a portgroup |
Part 6 |
Get-dvSwPg |
Find a portgroup |
Part 7 |
Set-dvSwPgVLAN |
Change the VLAN Id of a portgroup |
Part 7 |
Get-dvSwNetworkAdapter |
Get network adapter information |
Part 8 |
Set-dvSwNetworkAdapter |
Change portgroup connection of a network adapter |
Part 8 |
Get-dvPgTrafficShaping |
Get the traffic shaping settings of a portgroup |
Part 9 |
Set-dvPgTrafficShaping |
Set the traffic shaping settings of a portgroup |
Part 9 |
New-dvSwNetworkResourcePool |
Create a user-defined network resource pool |
Part 10 |
Remove-dvSwNetworkResourcePool |
Remove a user-defined network resource pool |
Part 10 |
Get-dvSwNetworkResourcePool |
Retrieve user-defined network resourcepool(s) |
Part 10 |
Set-dvSwSIOC |
Enable/disable NetIOC on a dvSw |
Part 10 |
Get-dvSwSIOC |
Retrieve the NetIOC status |
Part 10 |
Get-dvVmPort |
Get port used by VM NIC |
Part 11 |
The previous parts (Part1, Part2 & Part 3) in the dvSwitch series showed how to create a dvSwitch, a portgroup for Virtual Machines and a Service Console & vmKernle portgroup. The test setup now looks something like this:
The double Service Consoles and vmKernel connection might look confusing at first. But when you select one these connections, the vSphere client will show you to which uplink a specific connection is going.
Read more…
In the previous dvSwitch posts (see Part1 & Part2) I created a dvSwitch with a dvPortgroup, and we migrated some guests to this dvSwitch .
In this part I’ll show you how to create Service Console and vmKernel portgroups over the dvSwitch. Again, all the shown scripts will do a minimal configuration of the new portgroups. More advanced configurations will be discussed in future posts in the dvSwitch series.
This is the schematic view of the configuration that we currently have.