I am trying to update the RDP_Listening SSL thumbprint. I have spent hours reading examples and am not able to figure out why it is not working for me.
First I get the thumbprint and set the variable $Thumbprint. Then use the preferred PowerShell Set-WmiInstance only for it to hang and PowerShell ISE red button never goes away.
$Thumbprint = Get-ChildItem -Path Cert:\LocalMachine\My | Out-GridView -Title Thumbprint -PassThru $path = (Get-WmiObject -class "Win32_TSGeneralSetting" -Namespace root\cimv2\terminalservices -Filter "TerminalName='RDP-tcp'").__path Set-WmiInstance -Path $path -Arguments @{SSLCertificateSHA1Hash="$Thumbprint"} Execution policy is unrestricted, the certificate has a private key, the certificate has enhanced feature 'Server Authentication'. ISE is running as Administrator. I am guessing that the variable isn't being read?
21 Answer
You need to expand the Thumbprint property. You're getting the entire certificate object right now. Add |Select -ExpandProperty Thumbprint to the end of your first line.