【问题标题】:how to install a Powershell module in Powershell 4?如何在 Powershell 4 中安装 Powershell 模块?
【发布时间】:2021-07-18 08:19:24
【问题描述】:

我有一些机器在Powershell 4

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

当我在 Powershell 5 上的机器上执行相同操作时,我可以在 Modules 下拉列表中看到新模块,如下所示。

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

【问题讨论】:

  • PowerShell 6.0 于 2018 年 1 月发布,并于 2019 年 2 月终止。也许是时候升级到比 4.0 和 5.0 更现代的 PowerShell 版本了?
  • 我一直在看upgrading to powershell 7
  • 既然您正在考虑升级到 PowerShell 7,让我添加一些有关 Windows PowerShell ISE 未来的信息:
  • PowerShell ISE 是 no longer actively developedthere are reasons not to use it(底部),特别是无法运行 PowerShell [Core] 6+。提供跨平台最佳 PowerShell 开发体验的积极开发的编辑器是Visual Studio Code,结合了它的PowerShell extension
  • @mklement0 感谢您提供的链接 - 正是我所需要的,我已经在寻找适用于 PowerShell 7 的 ISE,我很高兴并感谢您发布这些链接

标签: sql-server powershell powershell-4.0 powershell-module dbatools


【解决方案1】:

按照cmets中Larnu提供的link

找到powershell模块文件.psm1后运行如下命令:

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

【讨论】:

    猜你喜欢
    • 2012-11-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-28
    • 1970-01-01
    相关资源
    最近更新 更多