Skip to content

Instantly share code, notes, and snippets.

@Alives
Created April 15, 2022 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Alives/8b2ba6f218be9c1eedc9997048084a5e to your computer and use it in GitHub Desktop.
Save Alives/8b2ba6f218be9c1eedc9997048084a5e to your computer and use it in GitHub Desktop.
Set a 10 year self-signed RDP (Remote Desktop) cert
$date_now = Get-Date
$extended_date = $date_now.AddYears(10)
$cert = New-SelfSignedCertificate -certstorelocation cert:\localmachine\my -notafter $extended_date -dnsname <your dns name> -KeyAlgorithm RSA -KeyLength 4096
Get-ChildItem -Path Cert:LocalMachine\MY | Select-Object FriendlyName, Thumbprint, Subject, NotBefore, NotAfter
wmic /namespace:\\root\cimv2\TerminalServices PATH Win32_TSGeneralSetting Set SSLCertificateSHA1Hash="<your thumbprint>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment