13

以前使用 PowerShell 3。升级到 PowerShell 4 并将其卸载,如面临错误所述。 Import-Module : The specified module 'SQLPS' was not loaded because no valid module file was found in any module directory.但是所有与 SQL 相关的东西都可以正常工作,没有错误。PowerShell 控制台中此错误的根本原因是什么?

4

2 回答 2

18

听起来您需要手动更新模块路径。

检查计算机上是否存在此目录。

C:\Program Files (x86)\Microsoft SQL Server\110\Tools\PowerShell\Modules\SQLPS

[固定的]

如果确实如此,则运行

$env:PSModulePath = $env:PSModulePath + ";C:\Program Files (x86)\Microsoft SQL Server\110\Tools\PowerShell\Modules"

然后检查 SQLPS 模块是否在可用模块列表中

get-module -listavailable
于 2016-03-27T17:01:08.613 回答
-4

它只是正常的错误。

Step: 1 - We have to check the Path[[ C:\Program Files (x86)\Microsoft SQL Server\110\Tools\PowerShell\Modules\SQLPS]] is available in our machine.

If yes, follow step 2

Step: 2. Just copy the [SQLPS] folder from the above link 

Step: 3. Paste the same in [[C:\Windows\system32\WindowsPowerShell\v1.0\Modules\\\

Step: 4 Its been occur due to unavailability of the SQLPS
于 2018-12-06T05:13:02.607 回答