VMware’s PowerCLI is probably the most used tool on any of my computers outside of a web browser. They are continuing to improve upon the product that basically saved powershells life (my personal opinion). With that said, I am constantly building little functions, modules, scripts to perform simple tasks.
I’ll be leaving as much of my work on my personal GitHub workspace. Feel free to check it out.
So, Get-ConsoleURL what is it? As you would imagine, its a simple function that returns the URL of a VM’s web console. Why is this important? Well wouldn’t it be nice to quickly share this with a co-worker? Or save this URL in a custom app/webpage you have? The Open-VMConsoleWindow function is very useful in a local machine, but it requires Powercli and opens a local copy of the vmrc. This function I have created will give you a shareable link to the vCenter and reference the vm via the MoRef.
Check out my function here (Get-ConsoleURL).
Get-ConsoleURL -vmName $vmName -vCenterUN $username -vCenterPW $password
Differences in return:
Open-VMConsoleWindow -UrlOnly -vm $vm
Get-ConsoleURL -vmname $vm
I have a few issues open to add some functionality as well as improve the error handling.