1

我已经安装了报表服务器数据库(SSRS 2016)。我知道如何通过 RS 配置管理器配置报表服务器,但我想使用 power shell 自动执行此操作。我想将 Webservice 和 WebPortal URL 更改为“https”并绑定已导入到受信任的根证书颁发机构的证书。并且证书存在于位置 C:\Temp。

我正在尝试下面的脚本

$httpsPort = 443;
$ipAddress = "0.0.0.0";
$certpwd = '******abc'
$certpwd1 = ConvertTo-SecureString -String $certpwd -Force –AsPlainText
$Thumbprint = (Get-PfxData -Password $certpwd1 -FilePath  
C:\Temp\INBLRSHCPR12371.pfx).EndEntityCertificates.Thumbprint.ToLower()
$wmiName = (Get-WmiObject –namespace root\Microsoft\SqlServer\ReportServer 
-Filter "Name='$env:COMPUTERNAME'"  –class __Namespace).Name
$version = (Get-WmiObject –namespace 
root\Microsoft\SqlServer\ReportServer\$wmiName  –class __Namespace).Name
$rsConfig = Get-WmiObject –namespace 
"root\Microsoft\SqlServer\ReportServer\$wmiName\$version\Admin" -class 
MSReportServer_ConfigurationSetting
$rsConfig.ReserveURL("ReportServerWebApp","https://+:$httpsPort",(Get- 
Culture).Lcid)
$rsConfig.ReserveURL("ReportServerWebService","https://+:$httpsPort",(Get- 
Culture).Lcid)
$rsConfig.CreateSSLCertificateBinding('ReportServerWebApp', $Thumbprint, 
$ipAddress, $httpsport, (Get-Culture).LCID)
$rsConfig.CreateSSLCertificateBinding('ReportServerWebService', 
$Thumbprint, $ipAddress, $httpsport, (Get-Culture).Lcid) 
$rsconfig.SetServiceState($false, $false, $false)
$rsconfig.SetServiceState($true, $true, $true)

运行脚本时出现以下错误:

Get-WmiObject : Invalid parameter 
At line:7 char:13
+ $version = (Get-WmiObject –namespace root\Microsoft\SqlServer\ReportS ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], 
ManagementException
+ FullyQualifiedErrorId : 
GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

任何用于解决错误的代码或链接都是可观的,谢谢您提前

4

0 回答 0