Three lines of powershell

Forum for things that doesn't really have anything to do with hMailServer. Such as php.ini, beer, etc etc.
Post Reply
mats
Normal user
Normal user
Posts: 46
Joined: 2018-05-06 20:58

Three lines of powershell

Post by mats » 2023-02-02 22:26

Is all it takes to make RDP use a (letsencrypt) certificate from the local certstore

Code: Select all

$TSGeneralSetting = Get-WmiObject "Win32_TSGeneralSetting" -ComputerName "." -Namespace root\cimv2\terminalservices -Filter "TerminalName='RDP-tcp'"
$TSGeneralSetting.SSLCertificateSHA1Hash = (Get-ChildItem -Path Cert:\LocalMachine\my | WHERE {$_.Subject -match "[b]CN=mail.example.com[/b]" } | Sort-Object -Descending NotBefore | Select -First 1).Thumbprint
$TSGeneralSetting.put()
Change mail.example.com as needed

I will test it with the certifytheweb client and see if it will autoupdate on cert renew

Post Reply