在PowerShell中立即安装带有最小值的多个模块

发布于 2025-01-17 20:00:11 字数 331 浏览 2 评论 0原文

我想知道是否可以在PowerShell中安装多个模块(当然是),但是指定了最小值。

假设我们有两个模块要安装:

  1. AIPService版本1.0.0.5
  2. ExchangeOnLineManagement版本2.0.5

是否可以一行进行操作?

我尝试以下操作:

Install-Module -Name AIPService, ExchangeOnlineManagement -MinimumVersion 1.0.0.5, 2.0.5

认为这将有效,这是因为我们能够列出多个模块。

i would like to know if it is possible to install multiple modules in PowerShell (which of course is) but with specifying a minimumversion number.

Let's assume we have two modules to install:

  1. AIPService version 1.0.0.5
  2. ExchangeOnlineManagement version 2.0.5

Is it possible to do it in one line?

I tried following:

Install-Module -Name AIPService, ExchangeOnlineManagement -MinimumVersion 1.0.0.5, 2.0.5

Thought that this would work due to the fact, that we are able to list multiple modules.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱已欠费 2025-01-24 20:00:11

正如文档所示,参数 - MaximumVersion 指定要安装的单个模块的最低版本。
在您的情况下,您需要为每个要安装的模块添加两行,因为您想要不同的版本或使用循环和哈希表来安装。像这样的东西:

$modules = @{
    AIPService               = '1.0.0.5'
    ExchangeOnlineManagement = '2.0.5'
}

$modules.GetEnumerator() | ForEach-Object {
    Install-Module -Name $_.Name -MinimumVersion $_.Value
}

As the docs show, parameter -MinimumVersion specifies the minimum version of a single module to install.
In your case, you need do add two separate lines for each module to install because you want a different version or use a loop and a Hashtable to install. Something like:

$modules = @{
    AIPService               = '1.0.0.5'
    ExchangeOnlineManagement = '2.0.5'
}

$modules.GetEnumerator() | ForEach-Object {
    Install-Module -Name $_.Name -MinimumVersion $_.Value
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文