I wrote a function to open VMRC from a PowerCLI prompt and although it's quick and dirty I thought I would share it with the community.
function Open-VMRC {
<#
.Synopsis
Function to replicate Open-VMConsoleWindow but use the VMware Remote Console Application
.Description
Connect to the virtual machine using the currently connected server object.
.Example
Get-VM "MyVM" | Open-VMRC
.Parameter VirtualMachine
Virtual Machine object
#>
#[CmdletBinding()]
param (
[Parameter(Mandatory=$true,ValueFromPipeline=$True)][VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl]$vm
)
$ServiceInstance = Get-View -Id ServiceInstance
$SessionManager = Get-View -Id $ServiceInstance.Content.SessionManager
$vmrcURI = "vmrc://clone:" + ($SessionManager.AcquireCloneTicket()) + "@" + $global:DefaultVIServer.Name + "/?moid=" + $vm.ExtensionData.MoRef.Value
Start-Process -FilePath $vmrcURI
}
I didn't bother with error handling for it, but if you drop it in your PowerShell $profile it can be a handy way to open a VM console while you're otherwise working in PowerCLI. I've tested it on Windows 10 with PowerCLI 6.3 to standalone VMware 6.0u2 hosts and vCenter 6.0u2. Its worth noting that if you connect directly to a host, you'll need to enable MOBs using the command:
Get-AdvancedSetting -Name Config.HostAgent.plugins.solo.enableMob -Entity ( Get-VMHost ) | Set-AdvancedSetting -Value $true
See also Open-VMConsole, posted to GitHub by Tunsworthy.
Thanks, I'll have to check that out. A full module might be more top heavy than a simple function in the current users' $profile but I might yet learn something from the code.
This worked on vCenter 7 perfectly (whereas the Tunsworthy solution did not work and is outdated), and it's far more simple (KISS principle).