PowerShell 4 - Import-Module:指定的模块 'SQLPS' 未加载,因为在任何模块目录中均未找到有效的模块文件

PowerShell 4 - Import-Module : The specified module 'SQLPS' was not loaded because no valid module file was found in any module directory

以前使用 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 控制台中此错误的根本原因是什么?

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

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

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

[固定]

如果是,那么 运行

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

然后使用

检查 SQLPS 模块是否在可用模块列表中
get-module -listavailable

只是正常的错误。

Step: 1 - We have to check the Path[[ C:\Program Files (x86)\Microsoft SQL Server0\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