[英]Automating Configuration of SSRS 2016 with powershell (Need to change URL from "https" of "http")
我已經安裝了報表服務器數據庫(SSRS 2016)。 我知道如何通過 RS 配置管理器配置報表服務器,但我想使用電源 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
任何用於解決錯誤的代碼或鏈接都是可觀的,謝謝您提前
我知道了我的問題:正確的工作腳本如下:
$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 -class
__Namespace -ComputerName $env:COMPUTERNAME).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)
嘗試以管理員身份執行您的腳本。
問題在於這條語句:$rsConfig = Get-WmiObject –namespace "root\Microsoft\SqlServer\ReportServer$wmiName$version\Admin" -class MSReportServer_ConfigurationSetting
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.