zoukankan      html  css  js  c++  java
  • Configure custom SSL certificate for RDP on Windows Server 2012 in Remote Administration mode

    Q:

    So the release of Windows Server 2012 has removed a lot of the old Remote Desktop related configuration utilities. In particular, there is no more Remote Desktop Session Host Configuration utility that gave you access to the RDP-Tcp properties dialog that let you configure a custom certificate for the RDSH to use. In its place is a nice new consolidated GUI that is part of the overall "edit deployment properties" workflow in the new Server Manager. The catch is that you only get access to that workflow if you have the Remote Desktop Services role installed (as far as I can tell).

    This seems like a bit of an oversight on Microsoft's part. How can we configure a custom SSL certificate for RDP on Windows Server 2012 when it's running in the default Remote Administration mode without needlessly installing the Remote Desktop Services role?

    Important: you need open a CMD by "Run as administrator" then perform the wmic command.

    A:

    38 down vote accepted

    It turns out that much of the configuration data for RDSH is stored in the Win32_TSGeneralSetting class in WMI in the rootcimv2TerminalServices namespace. The configured certificate for a given connection is referenced by the Thumbprint value of that certificate on a property called SSLCertificateSHA1Hash.

    In order to get the thumbprint value

    1. Open the properties dialog for your certificate and select the Details tab
    2. Scroll down to the Thumbprint field and copy the space delimited hex string into something like Notepad
    3. Remove all the spaces from the string. You'll also want to watch out for and remove a non-ascii character that sometimes gets copied just before the first character in the string. It's not visible in Notepad.
    4. This is the value you need to set in WMI. It should look something like this: 1ea1fd5b25b8c327be2c4e4852263efdb4d16af4.

    Now that you have the thumbprint value, here's a one-liner you can use to set the value using wmic:

    wmic /namespace:\rootcimv2TerminalServices PATH Win32_TSGeneralSetting Set SSLCertificateSHA1Hash="THUMBPRINT"
    

    Or if PowerShell is your thing, you can use this instead:

    $path = (Get-WmiObject -class "Win32_TSGeneralSetting" -Namespace rootcimv2	erminalservices -Filter "TerminalName='RDP-tcp'").__path
    Set-WmiInstance -Path $path -argument @{SSLCertificateSHA1Hash="THUMBPRINT"}
    

    It occurs to me that this solution would probably work on Windows 8 systems as well. I haven't played with it much myself yet though.

    Note: the certificate must be in the 'Personal' Certificate Store for the Computer account.

  • 相关阅读:
    [GeeksForGeeks] Maximum Length Chain of Pairs
    [Coding Made Simple] Buy/Sell stock with at most K transactions to maximize profit
    [LeetCode 10] Regular Expression Matching
    056_统计/etc/passwd 中 root 出现的次数
    055_使用脚本循环创建三位数字的文本文件(111-999 的所有文件)
    054_自动修改计划任务配置文件
    053_修改 Linux 系统的最大打开文件数量
    052_获取本机 MAC 地址
    051_循环关闭局域网中所有主机
    050_显示进度条(回旋镖版)
  • 原文地址:https://www.cnblogs.com/oskb/p/4800955.html
Copyright © 2011-2022 走看看