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.
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.
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.
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.
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!
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.
This website uses cookies to improve your experience. By using this website you agree to our policies found on our Read More. Cookie settingsACCEPT
Privacy & Cookies Policy
Privacy Overview
This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.