如何在 Powershell 4 中安装 Powershell 模块?

问题描述

我在 Powershell 4

上有一些机器

enter image description here

即使在我将新的 powershell 模块放置在模块路径中之后,在这些机器中 它们不会显示Modules 下拉列表中 - 如上所述。

当我在使用 Powershell 5 的机器上做同样的事情时,我可以在 Modules 下拉列表中看到新模块,如下所示。

enter image description here

为了使新模块显示在 Powershell 4 的 modules 下拉列表中,我还需要做什么?

解决方法

遵循link在评论中提供的Larnu

在我找到 powershell 模块文件 .psm1 并运行以下命令后:

import-Module  "C:\Program Files\WindowsPowerShell\Modules\dbatools\1.0.141\dbatools.psm1"

enter image description here