Powershell SSL Cert Assign Windows 2012 RDS

Use this power shell script when applying a purchased ssl certificate to your Terminal Server.

$pass = ConvertTo-SecureString “h3lpm3” -AsPlainText -Force
$thumbprint = (Import-PfxCertificate -Password $pass -CertStoreLocation cert:\localMachine\my -FilePath ‘C:\exitstencil.pfx’).thumbprint
$path = (Get-WmiObject -class “Win32_TSGeneralSetting” -Namespace root\cimv2\terminalservices -Filter “TerminalName=’RDP-tcp'”).__path
Set-WmiInstance -Path $path -argument @{SSLCertificateSHA1Hash=”$Thumbprint”}