UniFi Routers, VMware vSphere and vLAN Fun

Recently we upgraded the networking in our CoLo from our existing horrible, not all the features work correctly, bought off eBay NetGear switches to a brand new (actually purchased new) Ubiquiti network stack. We went with Ubiquiti because they have a really good reputation, they have a fantastic price point, and the UI is really simple to use while giving us all of the features that we were looking for.

Like any good IT deployment, we hit a snag when we were pushing out out network configuration. All of our servers have 10 Gig network cards in them, and our SAN also has 10 Gig network cards for our NFS shares (we are a VMware vSphere shop), so we have a storage network. We also wanted to put our VMs on the 10 Gig cards, as they were on 1 Gig ports before and we wanted them to have more bandwidth available to them.

In the UniFi software on the Ubiquiti equipment has two different networking setups. The base network which we setup as our management network. Then any other subsets that need to be setup are configured, but they require a VLAN to be configured. We had a few networks to setup, and those were our Infrastructure network which we gave a VLAN of 4 to, our Storage network which we gave a VLAN of 5 to, and our lab which we gave a VLAN of 100 to.

Our VMware servers all have a dedicated NIC which we are using for our Management ports, so we didn’t need to have the Management network be accessible from the NIC that the VMs were going to use. Within the UniFi software I created was is called a port profile which can contain a variety of subnets. This way a single switch port can be on multiple subnets, which was exactly what I wanted. I wanted the 10 Gig ports and their NICs to be on the Storage, Infrastructure, and Lab networks. So I created a single port profile with all of these subnets in it. As you can see from the screenshot below, when you do this you select a netive network for the port profile.

After I got this setup, I was getting weird responses from the VMs and the VMware hosts that were trying to talk to the storage. I put VLAN Ids in VMware or all these networks as well, but things still working talking correctly.

It turns out, that whatever network you have configured as the native network, within VMware this means that you don’t put a VLAN ID for it. So in my case the storage network within VMware does not get a VLAN ID, while the other networks do; even through the storage network has a VLAN ID of 5 within the UniFi OS.

Once I did that, the storage for the VMs was able to talk perfectly and all the VM Subnets worked as expected.


Contact the Author | Contact DCAC

Using the Clipboard in Azure Bastion

When I’m RPD’ed into a server, I copy and paste things from my desktop to the server all the time. Be in code that I’ve got saved in a doc on my desktop, or something from a webpage that I want to run when I’m troubleshooting something. With Azure Bastion you don’t have the ability to copy and paste as you don’t have an RDP window open, you’re using a web browser instead.

The clipboard editor when minimized

So how do you copy and paste, then you don’t have that ability? Well, Microsoft has given you a little clipboard editor, so you can see and modify what’s in the Azure VMs clipboard. To access the clipboard, find the two right arrows on the left-hand side of the window. They should be in the middle of the left side fo the browser and they should look something like this.

The clipboard editor when expanded

After you click on the arrows you’ll get a clipboard editor that looks something like this (the text will be different, I happened to be running a DISM command when I wrote this). This editor is on your workstation side, not the VM side so you can paste into this as needed, or copy from it to get text off of the Azure VM to your local workstation. Anything that you put into here will be available when you go into the workstation and paste.

Once you are done editing the clipboard (or copying out or it), simply click anywhere else in the VM to make the editor minimize again.

Getting data into your clipboard is suddenly much easier. Sadly there’s no solution for moving files through the Bastion, so those still need to be moved through something like SharePoint, OneDrive, etc. But this is a huge improvement for managing servers in Azure using the Bastion feature.


Contact the Author | Contact DCAC

Gathering VMWare Metrics

Anytime that you a large environment, gathering metrics in any form can be daunting and cumbersome.  Using scripting languages can usually greatly improve the efficiency of this process as well as be more accurate.  Whether it’s VMWare, SQL Server, or some other platform, it would behoove you to see what scripting languages it may support.

In a recent case, I had to gather some metrics from a VMWare implementation.  The environment had multiple hosts and each host had multiple virtual machines within them. I needed to gather metadata about each virtual machine on certain hosts.  I was looking data like:

  • Number of CPUs
  • How much memory is allocated
  • What is the operating system version
  • What virtual host is the VM on

Thankfully VMWare has its own flavor of Powershell, called PowerCLI, which can be used to gather all of the metrics easily and quickly.  You can find the documentation on PowerCLI here.  When looking into this scripting language keep in mind that different versions of VMWare will have different dialects for PowerCLI.  If you find that a particular cmdlet isn’t working, check the documentation to see if it is available for your particular version of ESX.

The Script

To start with, I’ll need credentials in order to connect to the vcenter server. From that vantage point, I can then jump into the pool of VMware resources.  Security is an utmost concern for me always, so getting the appropriate credentials securely is the way to go.  Thank fully, we can use the get-credential cmdlet which will secure my user name and password into a credential object.

#get credentials safely
$pass = get-credential

Getting the credentials in this manner allows me to not have to hard code anything into the script, namely my password.  This cmdlet will prompt you in a separate dialog window to enter your user id as well as your password.  The credential object can then be passed into the connect-viserver cmdlet by using the -credential switch.

#connet to the vcenter server
connect-viserver -server server1.domain.com -credential $pass

In the above cmdlet, we also pass in the -server value which tells the cmdlet which server I want to initiate a connection to.  Next, we can get a list of all virtual machines that reside on a given host, namely host1 and host2.  The host name isn’t a string by default so in order to make a comparison, I had to use the ToString() method.  Note that there might be a better alternative to this, but I needed the script quickly, so I didn’t waste a lot of time researching options.

#get all of the vm's that we are interested in which in this case reside on a particular host(s).
$vms = get-vm | ? {$_.VMHost.tostring() -eq "host1.domain.com" -or $_.VMHost.tostring() -eq "host2.domain.com"}
The $vms variable will be populated with a list of all of the virtual machines.  Now I can use a foreach loop and iterate through them and get their properties. I also wanted the ability to export the data into Excel where I could make it look prettier. In order to do this, I had to install the ImportExcel module.
#Note: the ImportExcel module is needed: 
install-module -name ImportExcel
foreach ($vm in $vms){
#get VM properties
$vm | select * | Export-excel -worksheetname "Virtual Machines" -path c:\temp\host1.xlsx -Append

The other set of information that I wanted was to make sure that the virtual machines were using the appropriate SCSI controllers.  For non-operating system drives, they should be using the paravirtual drivers.  We can use PowerCLI to get that information as well.  This will finish out the ForEach loop.

#get SCSI Controller Information
$vm | Get-scsicontroller | export-excel -worksheetname "SCSI Controllers" -path c:\temp\host1.xlsx -Append

Notice that in both export statements I included the Append switch.  If you do not include that, the process will over-write the entire file and the only thing that it would contain is the last virtual machine that the script touched.  This doesn’t do any good so we must append to the file.

You can see the entire script in the DCAC Github Repository.


This was a quick PowerCLI script that I put together to fetch as many metrics about each virtual machine from the ESX hosts.  It’s quick and short script and it can certainly be improved upon, such as adding in variables to make it cleaner.  Make sure if you make improvements, do a pull request on GitHub so we can incorporate your improvements!

© 2019, John Morehouse. All rights reserved.

Contact the Author | Contact DCAC

Recommended reading from mrdenny for November 4, 2016

This week I’ve found some great things for you to read. These are a few of my favorites that I’ve found this week.

Hopefully you find these articles as useful as I did. Don’t forget to follow me on Twitter where my username is @mrdenny.


The post Recommended reading from mrdenny for November 4, 2016 appeared first on SQL Server with Mr. Denny.

Contact the Author | Contact DCAC
1 2 3 6


Globally Recognized Expertise

As Microsoft MVP’s and Partners as well as VMware experts, we are summoned by companies all over the world to fine-tune and problem-solve the most difficult architecture, infrastructure and network challenges.

And sometimes we’re asked to share what we did, at events like Microsoft’s PASS Summit 2015.

Awards & Certifications

Microsoft Partner   Denny Cherry & Associates Consulting LLC BBB Business Review    Microsoft MVP    Microsoft Certified Master VMWare vExpert
INC 5000 Award for 2020    American Business Awards People's Choice    American Business Awards Gold Award    American Business Awards Silver Award    FT Americas’ Fastest Growing Companies 2020   
Best Full-Service Cloud Technology Consulting Company       Insights Sccess Award    Technology Headlines Award    Golden Bridge Gold Award    CIO Review Top 20 Azure Solutions Providers