Sql-server – Get-ItemProperty : Cannot find path ‘HKLM:\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.SqlServer.Management.PowerShell.sqlps’

powershellsql server

I've tried reinstalling SQL Server 2014 and I'm still getting the following error message when trying to import-module sqlps. The same registry key exists, but is appended with 120. I'm able to use commands like Invoke-SqlCmd. Not sure what the issue is here. Any help appreciated.

  • OS: Windows 7 Enterprise Version 6.1 Build 7601:Service Pack 1.
  • SQL Server: SQL Server 2014 Development Edition.

In x86 Window:

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

In x64 Window:

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:\>

Best Answer

Does it work if you change $sqlpsreg to HKLM\Software\Wow6432Node\Microsoft\PowerShell\1\ShellIds\Microsoft.SqlServer.Management.PowerShell.sql