Connecting to Homelab using Royal TSX and PowerCLI

So now that both PowerShell Core and PowerCLI is supported on macOS, I thought I wanted to share how to easily connect to your Homelab infrastructure by using Royal TSX and PowerCLI.

As the first step PowerShell Core and PowerCLI needs to be installed. Michael White (@mwVme) has a nice blogpost on how to install these.

Start by adding a Terminal item to the list of connections in one of your Royal TSX documents.

Now edit it and give it a nice name and set the “Connection Type” to “Custom”.

Assign a set of Credentials to the Terminal item. This ensures that the credentials used for connecting to your Homelab is securely stored inside the (hopefully encrypted) Royal TSX document.

Next set the checkmark for the setting “Run inside Login Shell” setting under Advanced, so that shell Royal TSX launches is in the current users context, so that the full path to initial “pwsh” command is not required.

Under “Custom Command” insert the below line, and edit it so that the server FQDN to your vCenter or as in my case a single ESXi host.

pwsh -NoExit -c Connect-VIserver -server -User $EffectiveUsername$ -Password $EffectivePassword$

Now once the Terminal item in the Navigation panel is double clicked, a BASH terminal session is started, launching PowerShell using the “pwsh” command, and an initial command “Connect-VIserver” cmdlet is executed, and the username and password is automatically supplied from the Royal TSX Credentials.

Now enjoy the fast and easy access to PowerCLI directly on macOS.

Tags: Homelab · PowerCLI · Royal TSX