Get Title of Remote Desktop Connection

How can I programatically get the title for an active Remote Desktop Connection (mstsc.exe) session window?

<hostname or IP> – Remote Desktop Connection

The title is shown in two places:

  1. Task Manager, when you expand the Process “Remote Desktop Connection” under Apps.
  2. The title bar of an un-maximized Remote Desktop Connection window

I tried using the following commands and utilities:

  1. PowerShell command: Get-Process
  2. PowerShell command: Get-CimInstance Win32_Process | Select *
  3. Microsoft Sysinternals Process Explorer
  4. tasklist /v