Windows OS Hub
  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux
  • Home
  • About

Windows OS Hub

  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux

 Windows OS Hub / Group Policies / Using SSL/TLS Certificates for Remote Desktop (RDP)

March 3, 2025 Group PoliciesPowerShellWindows 11Windows Server 2022

Using SSL/TLS Certificates for Remote Desktop (RDP)

This article aims to help administrators manage SSL/TLS certificates used to secure RDP connections in Windows. First, we will look at how to replace a self-signed RDP certificate with a trusted TLS certificate. If you have deployed a Certificate Authority (CA), you can configure a special template for RDP certificates and then use Group Policy (GPO) to automatically issue and bind SSL/TLS certificates to the Remote Desktop Services on domain computers.

Contents:
  • Remote Desktop (RDP) Self-Signed Certificate Warning
  • How to Install (Replace) the Self-Signed Remote Desktop Services Certificate
  • Configuring an RDP Certificate Template on a Certificate Authority (CA)
  • Deploy RDP Certificates Using Group Policy
  • Signing an RDP File with a Trusted TLS Certificate

Remote Desktop (RDP) Self-Signed Certificate Warning

By default, Windows generates a self-signed SSL certificate to secure RDP sessions. The user receives a warning when the mstsc.exe client connects to RDP/RDS for the first time:

The remote computer could not be authenticated due to problems with its security certificate. It may be unsafe to proceed.
Certificate error: The certificate is not from a trusted certifying authority.

To proceed and establish an RDP connection, the user has to click Yes. To prevent the RDP certificate warning from appearing every time, check the “Don’t ask me again to connect to this computer” option. Remote Desktop Connection (RDP) warning - Certificate is not from a trusted certifying authority

In this case, the RDP certificate thumbprint will be saved on the client in the CertHash parameter within the registry key that stores the RDP connection history (HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Servers\). If you have hidden the warning that the RDP server could not be verified, remove the certificate thumbprint from the registry to reset the setting.

rdp CertHash value in the registry

Although a self-signed certificate is used for a connection, your RDP session is secure and traffic is encrypted.

How to Install (Replace) the Self-Signed Remote Desktop Services Certificate

How to check which SSL certificate is currently used for Remote Desktop Services (RDP) on a computer? Run this command in the PowerShell console:

(Get-CimInstance -class "Win32_TSGeneralSetting" -Namespace root\cimv2\terminalservices -Filter "TerminalName='RDP-tcp'").SSLCertificateSHA1Hash

This command returns the SSL certificate thumbprint currently assigned to RDP services.

powershell: get rdp certificate thumbprint

Open the computer’s Certificate Management Console (certlm.msc) and go to Remote Desktop -> Certificates. Open the certificate properties, go to the Details tab, and verify that the certificate Thumbprint matches the one you received in the console.

View RDP certificate properties

If you have obtained a trusted SSL certificate from a third-party CA (this can be a commercial CA or a free Let’s Encrypt certificate), you can replace the self-signed RDP certificate with it.

In this case, you will need a certificate in PFX format (with the private key), which you must import into your computer’s Personal certificate store. In my case, it’s a Let’s Encrypt certificate already issued for Windows IIS using the WACS tool (the certificate is located in the Web Hosting -> Certificates section).

Copy the certificate to the Personal -> Certificates section. Copy the certificate thumbprint value.

Get Let's Encrypt TLS cert thumbprint

Paste the copied SSL certificate fingerprint into the following command to replace the old self-signed RDP certificate with the new one:

$certHash = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" -Name "SSLCertificateSHA1Hash" -Value $certHash

powershell: replace default rdp-tcp certificate

Restart the RD service for the new settings to take effect:

Restart-Service -Name TermService -Force

Then reconnect to the RDP host, click the lock icon in the top floating panel, and verify that the trusted TLS certificate is now being used for RDP.

Secured RDP conneciton with trusted TLS/SSL certificate encryption

Note that Let’s Encrypt certificates are issued for 90 days and are automatically reissued every 60 days. Therefore, after issuing a new Let’s Encrypt TLS certificate, you must replace it in the RDP configuration. This can be automated by using a PowerShell script that runs through the Task Scheduler.

Configuring an RDP Certificate Template on a Certificate Authority (CA)

If you have a Microsoft Certificate Authority (CA) deployed in your AD domain, you can configure it to automatically issue trusted SSL/TLS certificates for the Remote Desktop service on all computers.

Let’s create a new type of certificate template for use with RDP/RDS hosts at the CA.

  1. Open the Certificate Authority console and go to the Certificate Templates section
  2. Duplicate the Computer certificate template (Certificate Templates -> Manage -> Computer -> Duplicate);
    dublicate computer cetrificate template in windows ca
  3. Specify the name of the new certificate template (RDPTemplate) in the General tab. Make sure that the value in the Template Name field matches the Template display name
    create CA template to issue RDP certificates
  4. In the Compatibility tab, specify the minimum version of the client OS used in your domain (for example, Windows Server 2016 for CA and Windows 10 for clients). The result will be the use of stronger encryption algorithms.
  5. On the Application Policy Extensions tab, limit the scope of the certificate to Remote Desktop Authentication only (set the object identifier 1.3.6.1.4.1.311.54.1.2). Click Add -> New, create a new policy, and select it.ca template for Remote Desktop Authentication 1.3.6.1.4.1.311.54.1.2
  6. In the certificate template settings (Application Policies Extension), remove all policies except Remote Desktop Authentication  create Remote Desktop Authentication certificate policy template
  7. To use this RDP certificate template on domain controllers, open the Security tab, add the Domain Controllers group, and enable the Enroll and Autoenroll options for itallow Enroll and Autoenroll certificates to Domain Controllers
  8. Save the certificate template.
  9. Then, in the Certificate Authority MMC snap-in, click the Certificate Templates folder and select New -> Certificate Template to Issue -> select the RDPTemplate.
    new rdp certificate template in certification authority

Deploy RDP Certificates Using Group Policy

Next, configure a domain GPO to automatically assign RDP certificates according to the configured template.

It is assumed that all domain computers trust the corporate Certificate Authority (the CA root certificate was added to Trusted Root authorities on clients using GPO).
  1. Open the domain Group Policy Management console (gpmc.msc), create a new GPO object and link it to the OU containing RDP/RDS servers or computers to automatically issue TLS certificates for securing RDP
  2. Go to the GPO section Computer Configuration -> Policies -> Administrative Templates -> Windows Components -> Remote Desktop Services -> Remote Desktop Session Host -> Security. Enable the Server Authentication Certificate Template policy. Specify the name of the CA template you created earlier (RDPTemplate);configuring Server Authentication Certificate Template GPO options
  3. Then enable the Require use of specific security layer for remote (RDP) connections policy and set its value to SSL group policy parameter Require use of SSL security layer for remote (RDP) connections
  4. To automatically renew an RDP certificate, go to the Computer Configuration -> Windows settings -> Security Settings -> Public Key Policies section of the GPO and enable the Certificate Services Client – Auto-Enrollment Properties policy. Check the “Renew expired certificates, update pending certificates and remove revoked certificates” and “Update certificates that use certificate templates” options rdp certificate Auto-Enrollment group policy settings
  5. If you want your clients to always verify the RDP server certificate, enable the Configure Authentication for Client = Warn me if authentication fails policy (Computer Configuration -> Policies -> Administrative Templates -> Windows Components -> Remote Desktop Settings -> Remote Desktop Connection Client);
  6. If necessary, use Windows Defender Firewall policies to open the incoming RDP Port TCP/UDP 3389.
  7. Then, update Group Policy settings on the client computer, open the computer’s certificate console (Certlm.msc) and make sure that the Remote Desktop Authentication certificate issued by your CA appears in the Personal -> Certificates section.
    Use the gpresult tool and this article to diagnose if the new Group Policy settings have not been applied.

issued RDP certificates

Restart Remote Desktop Services to apply the new RDP certificate:

Get-Service TermService -ComputerName mun-dc01| Restart-Service –force –verbose

You won’t see a prompt to confirm that the certificate is trusted when you connect to a server via RDP (to see the prompt, connect to the server for which the certificate was issued using its IP address instead of the FQDN). Click View certificate, go to the Details tab, and copy the value in the Thumbprint field. get rdp certificate Thumbprint

You can also verify that a certificate based on the RDPTemplate has been issued to a specific Windows host in the Issued Certificates section of the Certification Authority console. Check the Thumbprint value of the certificate here:

get certificate Thumbprint via the certsrv mmc console

Compare this thumbprint to the certificate thumbprint used by the Remote Desktop Service. You can view the value of the RDS certificate thumbprint in the registry (HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations, the TemplateCertificate parameter) or using the following PowerShell command:

Get-WmiObject -Class "Win32_TSGeneralSetting" -Namespace root\cimv2\terminalservices|select SSLCertificateSHA1Hash
get rdp certificate thumbprint using powershell

Signing an RDP File with a Trusted TLS Certificate

If you don’t have a deployed CA but want to prevent users from seeing a warning when connecting to an RDP/RDS host, you can add the server certificate to the trusted list on user computers.

Get the value of the RDP certificate thumbprint as described above:

Get-WmiObject -Class "Win32_TSGeneralSetting" -Namespace root\cimv2\terminalservices|select SSLCertificateSHA1Hash

Use this thumbprint to sign the .RDP file using the RDPSign.exe tool:

rdpsign.exe /sha256 25A27B2947022CC11BAFF261234567DEB2ABC21 "C:\ps\mun-dc01.rdp"

Then, add this thumbprint to the trusted certificates on user computers via GPO. Specify the thumbprints (separated by semicolons) in the Specify SHA1 thumbprints of certificates representing trusted .rdp publishers policy under Computer Configuration -> Policies -> Administrative Templates -> Windows Components -> Remote Desktop Settings -> Remote Desktop Connection Client.

Remote Desktop Connection Client policy, adding trusted .rdp publishers

To configure the transparent RDP logon without entering a password (RDP Single Sign-On), enable the Allow delegation default credential policy and specify RDP/RDS host names in it (check this article).

6 comments
3
Facebook Twitter Google + Pinterest
previous post
Unable to Add/Remove Role: Windows Server Requires Restart
next post
How to Enable and Configure SNMP on VMWare ESXi Host

Related Reading

Unable to Map Drive: An extended error has...

May 13, 2025

Map a Network Drive over SSH (SSHFS) in...

May 13, 2025

Configure NTP Time Source for Active Directory Domain

May 6, 2025

How to Cancel Windows Update Pending Restart Loop

May 6, 2025

View Windows Update History with PowerShell (CMD)

April 30, 2025

6 comments

Harry B. November 29, 2022 - 4:51 pm

thx for the guide, it’s valuable information.
one minor thing… how were you able to sign any RDP files with certificates created according to the guide?
my research suggests, that one would have to add client/server authentification purposes to the template for signing to function properly. see here: https://social.technet.microsoft.com/Forums/en-US/732c2e27-6d24-47dc-91da-ae46d831f4b4/rdpsignexe-unable-to-use-certificate-0x8007000d?forum=winserverTS

rdpsign keeps bugging me with error 0x8007000d .

any idea?

Reply
admin January 9, 2023 - 3:46 am

Try to use the latest version of the rdpsign tool (https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/rdpsign)

If you attempting to sign an RDP file with an SHA-1 certificate on the newer version of Windows, you will encounter the following error:
Unable to use the certificate specified for signing. Error Code: 0x8007000d
The rdp file could not be signed. Error Code: 0x8007000d

Use the following command to sign the RDP file:
rdpsign.exe /sha256 yourcertthummbprint

Reply
ac June 13, 2024 - 1:45 pm

Is this RDPTemplate from GPO expected to be applied to the client workstations that would be attempting the RDP connections? Because in my case, it doesn’t. The GPO does get applied, as per gpresult /R. However, I don’t see the cert showing up in Personal/Certificates.

Reply
admin June 20, 2024 - 10:56 am

The GPO containing the RDPtemplate should be applied to target RDP hosts. Client machines should trust your Root CA certificate.
Are you using the Enterprise Root CA on Windows Server?

Reply
TM November 8, 2024 - 7:55 pm

Do you recommend “Publish certificate in Active Directory”?

Reply
SB March 29, 2025 - 11:29 am

Hey, not necessary in this case.
The publication of certificates within the ADDS is only necessary, when other PKI End-Entities need the public-key of a enrolled certificate of a user / machine. So, not necessary for this certificate use-case.

Reply

Leave a Comment Cancel Reply

join us telegram channel https://t.me/woshub
Join WindowsHub Telegram channel to get the latest updates!

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMware
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • Map a Network Drive over SSH (SSHFS) in Windows

    May 13, 2025
  • Configure NTP Time Source for Active Directory Domain

    May 6, 2025
  • Cannot Install Network Adapter Drivers on Windows Server

    April 29, 2025
  • Change BIOS from Legacy to UEFI without Reinstalling Windows

    April 21, 2025
  • How to Prefer IPv4 over IPv6 in Windows Networks

    April 9, 2025
  • Load Drivers from WinPE or Recovery CMD

    March 26, 2025
  • How to Block Common (Weak) Passwords in Active Directory

    March 25, 2025
  • Fix: The referenced assembly could not be found error (0x80073701) on Windows

    March 17, 2025
  • Exclude a Specific User or Computer from Group Policy

    March 12, 2025
  • AD Domain Join: Computer Account Re-use Blocked

    March 11, 2025

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • How to Hide or Show User Accounts from Login Screen on Windows
  • Configuring Proxy Settings on Windows Using Group Policy Preferences
  • Using WMI Filters to Target Group Policies in Active Directory
  • How to Disable NetBIOS, LLMNR, mDNS Protocols in Windows
  • Set Desktop Wallpaper and Logon Screen Background via Group Policy
  • How to Disable or Change User Account Control (UAC) Settings in Windows
  • How to Disable/Remove Thumbs.db File on Network Folders in Windows
Footer Logo

@2014 - 2024 - Windows OS Hub. All about operating systems for sysadmins


Back To Top