【发布时间】:2020-06-22 14:18:49
【问题描述】:
我有以下 Powershell 代码来恢复 Power BI 报表服务器实例上的加密密钥:
$encKeyPath = "C:\Test\enc.snk"
$encKeyPass = Read-Host 'Enter password for key:' -AsSecureString
Restore-RsEncryptionKey -ComputerName "localhost" -Password $encKeyPass -KeyPath $encKeyPath -ReportServerInstance PBIRS -ReportServerVersion SQLServer2016
当我运行它时,我得到了错误:
Get-WmiObject : Invalid namespace "root\Microsoft\SqlServer\ReportServer\RS_PBIRS\v13\Admin"
At C:\Users\MyUser\Documents\WindowsPowerShell\Modules\ReportingServicesTools\ReportingServicesTools\Functions\Utilities\New-Rs
ConfigurationSettingObject.ps1:100 char:19
+ $wmiObjects = Get-WmiObject @getWmiObjectParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-WmiObject], ManagementException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
我也尝试过使用-ReportServerInstance 和-ReportServerVersion 参数,但得到相同的错误消息。我还尝试了 -ComputerName 参数而不是 localhost 的本地计算机名称,但仍然没有运气。
错误似乎是指实际模块本身的错误,而不是我的代码。谁能建议我哪里出错了?
环境
- Power BI 报表服务器版本:1.8.7450.37410(2020 年 5 月)
- 实例名称:PBIRS
- 报告管理器 URL:http://localhost/reports
- 服务网址:http://localhost/reportserver
- ReportServer 数据库位于 SQL Server 2016 实例上(数据库名称为 PowerBIReportServer)
编辑:
到目前为止,使用这两个答案,我发现了以下内容:
Restore-RsEncryptionKey -ComputerName "localhost" -Password $encKeyPass -KeyPath $encKeyPath -ReportServerInstance PBIRS -ReportServerVersion SQLServer2016
投掷
Invalid namespace "root\Microsoft\SqlServer\ReportServer\RS_PBIRS\v13\Admin"
并更改 -ReportServerVersion:
Restore-RsEncryptionKey -ComputerName "localhost" -Password $encKeyPass -KeyPath $encKeyPath -ReportServerInstance PBIRS -ReportServerVersion SQLServer2017
投掷
Invalid namespace "root\Microsoft\SqlServer\ReportServer\RS_PBIRS\v14\Admin"
(注意版本差异)
运行
Get-WmiObject -Namespace "Root/Microsoft/SqlServer/ReportServer/RS_PBIRS" -Class __Namespace | Select-Object -Property Name | Sort Name
输出:
Name
----
V15
这说明为什么两个不同的-ReportServerVersion 参数会引发错误。
this page 建议
+--------------------+---------+
| SQL Server Release | Version |
+--------------------+---------+
| SQL Server 2012 | 11 |
| SQL Server 2014 | 12 |
| SQL Server 2016 | 13 |
| SQL Server 2017 | 14 |
| SQL Server 2019 | 15 |
+--------------------+---------+
但将-ReportServerVersion 更改为SQLServer2019 会返回:
Restore-RSEncryptionKey : Cannot process argument transformation on parameter 'ReportServerVersion'. Cannot convert value
"SQLServer2019" to type "Microsoft.ReportingServicesTools.SqlServerVersion". Error: "Unable to match the identifier name
SQLServer2019 to a valid enumerator name. Specify one of the following enumerator names and try again:
SQLServer2012, SQLServer2014, SQLServer2016, SQLServer2017, SQLServervNext"
At line:3 char:143
从这里开始,我想问题是:
如何让模块运行 v15 或如何获得模块/命名空间的第 13 版?
【问题讨论】:
-
你试过
-ReportServerVersion SQLServervNext吗? -
谢谢 - 它有效!威特的建议也奏效了。你们都是对的,但我必须选择一个答案来奖励赏金,恐怕我将不得不奖励 Witt,因为他的故障排除步骤更详细
标签: powershell reporting-services powerbi sql-server-2016