Remote Desktop Session Host registry settings

I want my sessions to terminate when Remote Desktop disconnects.

Right now I'm doing this manually ala:

Where I'm selecting End session as the option to When a session limit is reached or connection is broken:.

I'd like to do this with a script, and I want to know what the registry key is that I can set to make this the default behavior.

Dieser Artikel wurde möglicherweise automatisch übersetzt. Wenn Sie eine Rückmeldung bezüglich dessen Qualität geben möchten, teilen Sie uns diese über das Formular unten auf dieser Seite mit.

Dieser Artikel enthält Informationen zur Problembehandlung, wenn unter Windows Server 2012 keine Remotedesktop-Lizenzserver verfügbar sind.

Folgende Fehlermeldung kann angezeigt werden, wenn Sie eine Verbindung zu einem Remotedesktop-Sitzungshost (RDSH) unter Windows Server 2012 herstellen wollen:
 

Die Remote-Sitzung wurde getrennt, da keine Remote-Desktop-Lizenzserver verfügbar sind, um eine Lizenz bereitzustellen.
Bitte wenden Sie sich an den Serveradministrator.

Wenn dieser Fehler auftritt, werden möglicherweise keine Remotedesktopverbindungen mit dem Server hergestellt. Diese Fehlermeldung wird möglicherweise angezeigt, selbst wenn vorherige Remote-Desktop-Verbindungen zum Server erfolgreich waren und keine kürzlichen Änderungen am RDSH-Server vorgenommen wurden.

Auf der Microsoft Website ist ein Windows-Hotfix verfügbar, der hier heruntergeladen werden kann (externer Link).


 

Weitere Informationen:

Diese Informationen gelten für Windows Server 2012. Es gibt eine alternative Problemumgehung für dieses Problem.

Der erste Schritt, um den Fehler zu beheben, sollte darin bestehen, das RD-Lizenzierungsdiagnose-Tool vom Server-Manager aus auszuführen. Dieses Tool überprüft die vorhandene Konfiguration der Remotedesktoplizenzierung auf Probleme und bietet Vorschläge zur Fehlerbehebung für alle gefundenen Probleme. Wenn die RD-Lizenzierungsdiagnose die richtigen Lizenzierungsinformationen meldet und keine Probleme feststellt, kann das Problem durch einen offensichtlichen Fehler in Windows Server 2012 verursacht werden, bei dem der RDSH-Server den Lizenzierungsserver nicht kontaktieren kann, nachdem die 120-tägige Toleranzfrist der Lizenzierung abgelaufen ist.

Wenn die Lizenzierungskonfiguration korrekt erscheint und die RD-Lizenzierungsdiagnose keine Probleme meldet, führen Sie die folgenden Schritte aus:

  1. Öffnen Sie den Registrierungs-Editor (regedit).
  2. Wechseln Sie zu HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM. Exportieren Sie diesen Registrierungsschlüssel in eine Datei, bevor Sie Änderungen vornehmen.
  3. Suchen Sie den Schlüssel GracePeriod und löschen Sie ihn oder benennen Sie ihn um. Es kann notwendig sein, zuerst den Besitz des Schlüssels zu übernehmen und/oder seine Berechtigungen zu ändern.
  4. Starten Sie den RDSH-Server neu. Sie sollten nun in der Lage sein, sich erfolgreich mit ihm zu verbinden.

  -

-

Wenn nicht anders angegeben, sind alle Felder Pflichtfelder.

Vielen Dank für Ihr Feedback.

Derzeit ist kein Zugriff auf das Feedbacksystem möglich. Bitte versuchen Sie es später erneut.

Die folgenden Sonderzeichen dürfen in Kommentaren nicht verwendet werden: <>()\

You can run Remote Desktop Session Host Configuration from any of the following locations:

  • Start menu
  • Server Manager
  • Microsoft Management Console
Note

Remote Desktop Session Host Configuration is only available in Server Manager if the Remote Desktop Services role is installed on the computer.

Membership in the local Administrators group, or equivalent, on the RD Session Host server that you plan to configure, is the minimum required to complete this procedure. Review details about using the appropriate accounts and group memberships at //go.microsoft.com/fwlink/?LinkId=83477.

To run Remote Desktop Session Host Configuration from the Start menu

  • Click Start, point to Administrative Tools, point to Remote Desktop Services, and then click Remote Desktop Session Host Configuration.

  • Click Start, click Run, type tsconfig.msc and then press ENTER.

To run Remote Desktop Session Host Configuration from Server Manager
  1. Click Start, point to Administrative Tools, and then click Server Manager.

  2. In the left pane, expand Roles.

  3. Expand Remote Desktop Services, and then click Remote Desktop Session Host Configuration.

To run Remote Desktop Session Host Configuration from the Microsoft Management Console
  1. Click Start, click Run, type mmc and then press ENTER.

  2. On the File menu, click Add/Remove Snap-in.

  3. Under Available snap-ins, click Remote Desktop Session Host Configuration, and then click Add.

  4. In the Select Computer dialog box, select whether you want to connect to the local computer or to another computer. If you select Another computer, either type in the name of the computer or use Browse to search for the computer.

  5. Click OK.

  6. In the Add or Remove Snap-ins dialog box, click OK.

When trying to configure a new RDSH node in the RDS farm running Windows Server 2012 R2/2016/2019, you may encountered with the following warning popup message in the system tray:

Judging by error message, the RDS Host is running in the grace period (during the grace period of 120 days, you can use the Remote Desktop Session Host without activating RDS licenses). When the grace period ends, users won’t be able to connect to RDSH, and an error will appear in the tray:

Remote Desktop Services will stop working because this computer is past grace period and has not contacted at least a valid Windows Server 2012 license server. Click this message to open RD Session Host Server Configuration to use Licensing Diagnosis.

For more accurate diagnostic of the problem, you need to run the RD Licensing Diagnoser tool— lsdiag.msc (Administrative Tools -> Remote Desktop Services -> RD Licensing Diagnoser). Its window shows the following error:

Licenses are not available for the Remote Desktop Session Host server, and RD Licensing Diagnoser has identified licensing problem for the RD Session Host server. Licensing mode for the Remote Desktop Session Host is not configured. The Remote Desktop Session Host server is within its grace period, but the Session Host server has not been configured with any license server.

As you can see, there are no licenses available to clients, since the licensing mode is not set.

It means that the administrator did not specify the RDS Licensing Server and/or the licensing mode. It should be done even if the licensing type has already been specified when deploying the RDS host (Configure the deployment -> RD Licensing -> Select the Remote Desktop licensing mode).

You can check whether the RDS license server is set using the following PowerShell commands:

$obj = gwmi -namespace "Root/CIMV2/TerminalServices" Win32_TerminalServiceSetting
$obj.GetSpecifiedLicenseServerList()

If the RDS icense server is not set, you can specify it with the command:

$obj.SetSpecifiedLicenseServerList("uk-rdslic1.woshub.com")

There are several methods to force set the RDS licensing mode.

Using the registry:

In the registry key HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\Licensing Core change the value of the DWORD parameter with the name LicensingMode from 5 to:

  • 2 – if Per Device RDS licensing mode is used;
  • 4 – if Per User licensing is used.

You can change the registry setting manually through regedit.exe or the following PowerShell commands from the registry management module:

# Specify the RDS licensing type: 2 - Per Device CAL, 4 - Per User CAL $RDSCALMode = 2 # RDS Licensing host name $RDSlicServer = "uk-rdslic1.woshub.com" # Set the server name and type of licensing in the registry New-Item "HKLM:\SYSTEM\CurrentControlSet\Services\TermService\Parameters\LicenseServers" New-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Services\TermService\Parameters\LicenseServers" -Name SpecifiedLicenseServers -Value $RDSlicServer -PropertyType "MultiString"

Set-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\Licensing Core\" -Name "LicensingMode" -Value $RDSCALMode

After you have made the changes, restart your RDSH server.

You can also configure the RDS license server parameters using GPO (a local or a domain policy). If your RDS server is in a workgroup (not joined to the Active Directory domain), use the local Group Policy Editor gpedit.msc. Go to Computer Configuration -> Administrative Templates -> Windows Components -> Remote Desktop Services -> Remote Desktop Session Host -> Licensing.

We need two policies:

  • Use the specified Remote Desktop license servers – enable the policy and specify the RDS license server address. If the license server is running on the same server, type 127.0.0.1;
  • Set the Remote Desktop licensing mode – select the licensing mode. In our case, it is Per User.

After restarting your server, open the RD Licensing Diagnoser and check the number of available RDS licenses and the licensing mode you have selected.

Also note that if, for example, Windows Server 2012 R2 and CAL for RDS 2012 R2 are installed on the RD Licensing Server, you won’t be able to install RDS CAL licenses for Windows Server 2016/2019. The “Remote Desktop Licensing mode is not configured” error persists even if you specify the correct license type and RDS license server name. Old Windows Server version simply do not support RDS CALs for newer versions.

In this case the following message will be displayed in the RD License Diagnoser window:

The Remote Desktop Session Host is in Per User licensing mode and no Redirector Mode, but license server does not have any installed license with the following attributes: Product version: Windows Server 2016 Use RD Licensing Manager to install the appropriate licenses on the license server.

First you will have to upgrade the Windows Server version on the RDS license server (or to deploy a new RD License host). A newer version of Windows Server (for example, WS 2019) supports RDS CAL for all previous versions of Windows Server.

Video liên quan

Chủ đề