安装rdp证书的脚本

时间:2017-06-14 17:14:57

标签: powershell ssl windows-server-2012-r2 rdp

我有300多台服务器2012r2服务器,我们需要重新安装ssl证书。我们可以手动继续安装它,但300多台服务器将会有点平凡。必须有一个脚本或powershell命令,允许我自动执行此操作。我发现了一个脚本并对其进行了修改,但它似乎没有替换或添加证书到rdp,我做错了什么?

$CertificatePassword ="certpassword"
$CertificateImport ="location to cert"
$RDCB = "$env:COMPUTERNAME"+".domainname.com"
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
#Import the RemoteDesktop module
Import-Module RemoteDesktop
#Certificate Password
$Password = ConvertTo-SecureString -String $CertificatePassword -
AsPlainText -Force  
#Configure RDPublishing Certificate for RDS
set-RDCertificate -Role RDPublishing 
-ImportPath $CertificateImport 
-Password $Password 
-ConnectionBroker $RDCB -Force 
#Configure First RDWebAccess Certificate for RDS
set-RDCertificate -Role RDWebAccess 
-ImportPath $CertificateImport 
-Password $Password 
-ConnectionBroker $RDCB -Force 
#Configure RDRedirector Certificate for RDS
set-RDCertificate -Role RDRedirector 
-ImportPath $CertificateImport 
-Password $Password 
-ConnectionBroker $RDCB -force 
#Configure First RDGateway Certificate for RDS
set-RDCertificate -Role RDGateway 
-ImportPath $CertificateImport 
-Password $Password 
-ConnectionBroker $RDCB -force`

enter image description here

0 个答案:

没有答案
相关问题