Replace Generic RDP Certificate

M

mygeek911

Hi, I am trying to replace the generic RDP certificate with another one. I am using the following PowerShell code:

$pass = ConvertTo-SecureString "YourPasswordHere" -AsPlainText -Force
$thumbprint = (Import-PfxCertificate -Password $pass -CertStoreLocation cert:\localMachine\my -FilePath '\\path\to\certificate').thumbprint
$path = (Get-WmiObject -class "Win32_TSGeneralSetting" -Namespace root\cimv2\terminalservices -Filter "TerminalName='RDP-tcp'").__path
Set-WmiInstance -Path $path -argument @{SSLCertificateSHA1Hash="thumbprint"}

I keep receiving, however, the following error and I am not sure what is going on:

Set-WmiInstance : Invalid parameter
At line:4 char:1
+ Set-WmiInstance -Path $path -argument @{SSLCertificateSHA1Hash="thumbprint"}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: :)) [Set-WmiInstance], ManagementException
+ FullyQualifiedErrorId : SetWMIManagementException,Microsoft.PowerShell.Commands.SetWmiInstance


Any ideas?

Continue reading...
 
Back
Top Bottom