Get-ItemProperty:找不到路径“HKLM:\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.SqlServer.Management.PowerShell.sqlps”

Get-ItemProperty:找不到路径“HKLM:\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.SqlServer.Management.PowerShell.sqlps”

我尝试重新安装 SQL Server 2014,但在尝试时仍然收到以下错误消息import-module sqlps。存在相同的注册表项,但附加了 120。我可以使用类似这样的命令Invoke-SqlCmd。不确定这里的问题是什么。任何帮助表示感谢。

  • 操作系统:Windows 7 Enterprise 版本 6.1 Build 7601:Service Pack 1。
  • SQL Server:SQL Server 2014 开发版。

在 x86 窗口中:

PS H:> import-module sqlps -disablenamechecking
Get-ItemProperty : Cannot find path 'HKLM:\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.SqlServer.Management.PowerShell.sqlps' because it does not exist.
At C:\Users\russell_johnson\Documents\WindowsPowerShell\Modules\sqlps\sqlps.psm1:26 char:13
+     $item = Get-ItemProperty $sqlpsreg
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (HKLM:\SOFTWARE...owerShell.sqlps:String) [Get-ItemProperty], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemPropertyCommand

在 x64 窗口中:

PS H:\> import-module sqlps
Get-ItemProperty : Cannot find path 'HKLM:\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.SqlServer.Management.PowerShell.sqlps' because it does not exist.
At C:\Users\russell_johnson\Documents\WindowsPowerShell\Modules\sqlps\sqlps.psm1:26 char:13
+     $item = Get-ItemProperty $sqlpsreg
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound : (HKLM:\SOFTWARE\...owerShell.sqlps:String) [Get-ItemProperty], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemPropertyCommand

WARNING: The names of some imported commands from the module 'sqlps'
include unapproved verbs that might make them less  discoverable. To
find the commands with unapproved verbs, run the Import-Module command
again with the Verbose parameter. For a list of approved verbs, type
Get-Verb.

PS SQLSERVER:\>

答案1

如果将 $sqlpsreg 更改为 HKLM\Software\Wow6432Node\Microsoft\PowerShell\1\ShellIds\Microsoft.SqlServer.Management.PowerShell.sql,它会起作用吗?

答案2

运行 SQL 2014 更新脚本至 HKLM:\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.SqlServer.Management.PowerShell.sqlps120

按预期运行

相关内容