Find the license server of a Remote Desktop Session Host
One PowerShell line shows which Remote Desktop license server an RD Session Host is configured to use.
Infrastructure microsoftIn a Remote Desktop Services (RDS) environment you often need to know which server holds the licenses: to add or remove licenses, to troubleshoot, or to report on usage. The license server can run on the same machine as the Remote Desktop Session Host (RDSH) or on a separate one with the Remote Desktop Licensing role service installed.
The command
Run this in an elevated PowerShell session on the session host:
(Get-WmiObject -NameSpace root\CIMV2\TerminalServices Win32_TerminalServiceSetting).GetSpecifiedLicenseServerList()
It queries the Win32_TerminalServiceSetting class in the TerminalServices WMI
namespace. Its GetSpecifiedLicenseServerList() method returns the license
servers configured on that host.
More options are documented in the reference for
Get-WmiObject.