param( [Parameter(Position=0,Mandatory=$true)] [string]$cn, [Parameter(Position=1,Mandatory=$true)] [string]$thumbprint, [Parameter(Position=2,Mandatory=$true)] [string]$path, [Parameter(Position=3,Mandatory=$true)] [string]$pwd ) $destPath = "Users\$env:username\tmp.pfx" $destLocalPath = "C:\$destPath" $destUNCPath = "\\$cn\C$\$destPath" Copy "$path" "$destUNCPath" wmic /node:`"$cn`" process call create "powershell /c Import-PfxCertificate -FilePath '$destLocalPath' -CertStoreLocation Cert:\LocalMachine\My -Password ( ConvertTo-SecureString -String '$pwd' -Force -AsPlainText ); Remove-Item '$destLocalPath'" Start-Sleep 2 wmic /node:`"$cn`" /namespace:\\root\cimv2\TerminalServices PATH Win32_TSGeneralSetting Set SSLCertificateSHA1Hash="$thumbprint"