Set-Wmiinstance -Arguments $Variable Hangs

Set-Wmiinstance -Arguments $Variable Hangs

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?

2

1 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

David Miller
Author

David Miller

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.