top of page
  • Brock Peterson

Launch VMRC from Aria Operations

I wanted to use Aria Operations to search for VMs, determine which vCenter managed them, and connect to that vCenter to explore. I created a Dashboard using a View, 5 Text Widgets, and an Advanced Object Relationship.



I can search for and select the VM I want from the list on the left, which will in turn drive the Advanced Object Relationship on the right, showing me the vCenter managing that VM. I can then select that vCenter, go to DETAILS - ACTIONS - Open vCenter in vSphere Client.



Alternatively, I could just copy and paste the provided vCenter link into a new browser and launch from there. Finally, I could launch the appropriate vCenter directly from one of the four text widgets providing the links, but they don't show all that well as they can't be rendered in iFrames.


This approach works and is fine, but there is a much better way, enter my esteemed colleague, Dale Hassinger! I was talking to Dale about this and he said..."I did this thing a while back where I wrote a PowerShell script to create an HTML file listing the VMRC links to all my VMs and hosted that on a web site. I then embeded the link in a Text Widget, which I could then search." Perfect, let's do it!


First you'll need a web server, I'm using Nginx on Ubuntu. Then you'll need to install PowerShell and PowerCLI to run the script that generates the html. Dale and I ran through the following:

Update the list of packages: sudo apt-get update

Install pre-requisite packages: sudo apt-get install -y wget apt-transport-https software-properties-common

Get the version of Ubuntu: source /etc/os-release

Download the Microsoft repository keys: wget -q https://packages.microsoft.com/config/ubuntu/$VERSION_ID/packages-microsoft-prod.deb

Register the Microsoft repository keys: sudo dpkg -i packages-microsoft-prod.deb

Delete the Microsoft repository keys file: rm packages-microsoft-prod.deb

Update the list of packages after we added packages.microsoft.com:
sudo apt-get update

Install PowerShell: sudo apt-get install -y powershell

Start PowerShell: pwsh

Install PowerCLI: install-module VMware.PowerCLI

Adjust Nginx config to allows web pages to be embedded into other sites, add this line to /etc/nginx/sites-available/default:  add_header Content-Security-Policy "frame-ancestors *";

Restart Nginx to use new config: service nginx restart

Run PowerShell script manually to test: pwsh /root/vmrc.ps1

Add to local crontab if you'd like to runs, I'm running mine daily at 1:45 AM: 45 01 * * * /root/vmrc.ps1

Once run, I can check my webpage at https://bp-webssl-1.tvs.vmware.com/vmrc.html.



I'll embed this URL into a text widget, like this.



Adjusting our original dashboard, we now have this!



Search for your VM, select it, and you'll be prompted for vCenter credentials and ultimately the VMRC for your VM!


I shared the Dashboard here. Remember to adjust your Text Widgets accordingly after you've imported both the Dashboard and the accompanying View.


Also, be sure to install VMRC on your workstation. If you're running macOS, you'll have to get VMware Remote Console from the App Store.



So awesome, such power, thanks for your insight Dale! And thanks for being such a generous contributor to the larger VMware by Broadcom community. As you can see, Dale shared his PowerShell script on GitHub, he also maintains an active blog at vcrocs.info, check it out when you have time.

Comments


bottom of page