gpt4 book ai didi

powershell - 安装特定版本的 AzureRM.* 模块

转载 作者:行者123 更新时间:2023-12-04 02:03:57 25 4
gpt4 key购买 nike

我想安装所有 AzureRM.* 模块的特定版本,因为有 26 个模块,我不想一一手动安装:

PS C:\Users\hyar> find-module -name azurerm.*

Version Name Type Repository Description
------- ---- ---- ---------- -----------
1.0.5 AzureRM.profile Module PSGallery Microsoft Azure PowerShell - Profile ...
1.0.5 AzureRM.Storage Module PSGallery Microsoft Azure PowerShell - Storage ...
1.0.5 AzureRM.Automation Module PSGallery Microsoft Azure PowerShell - Automati...
1.0.5 AzureRM.Resources Module PSGallery Microsoft Azure PowerShell - Azure Re...
1.2.4 AzureRM.Compute Module PSGallery Microsoft Azure PowerShell - Compute ...
1.0.5 AzureRM.ApiManagement Module PSGallery Microsoft Azure PowerShell - Api Mana...
1.0.5 AzureRM.Backup Module PSGallery Microsoft Azure PowerShell - Azure Ba...
1.0.5 AzureRM.Network Module PSGallery Microsoft Azure PowerShell - Network ...
1.0.6 AzureRM.HDInsight Module PSGallery Microsoft Azure PowerShell - HDInsigh...
1.0.5 AzureRM.Batch Module PSGallery Microsoft Azure PowerShell - Batch se...
1.0.5 AzureRM.DataFactories Module PSGallery Microsoft Azure PowerShell - DataFact...
1.0.5 AzureRM.Insights Module PSGallery Microsoft Azure PowerShell - Insights...
1.1.4 AzureRM.SiteRecovery Module PSGallery Microsoft Azure PowerShell - SiteReco...
1.0.5 AzureRM.Sql Module PSGallery Microsoft Azure PowerShell - Sql serv...
1.0.5 AzureRM.Dns Module PSGallery Microsoft Azure PowerShell - Dns serv...
1.1.3 AzureRM.RedisCache Module PSGallery Microsoft Azure PowerShell - RedisCac...
1.0.5 AzureRM.OperationalInsights Module PSGallery Microsoft Azure PowerShell - Operatio...
1.1.4 AzureRM.KeyVault Module PSGallery Microsoft Azure PowerShell - KeyVault...
1.0.5 AzureRM.Websites Module PSGallery Microsoft Azure PowerShell - Websites...
1.0.5 AzureRM.Tags Module PSGallery Microsoft Azure PowerShell - Tags ser...
1.0.5 AzureRM.StreamAnalytics Module PSGallery Microsoft Azure PowerShell - StreamAn...
1.0.5 AzureRM.TrafficManager Module PSGallery Microsoft Azure PowerShell - TrafficM...
1.0.5 AzureRM.UsageAggregates Module PSGallery Microsoft Azure PowerShell - UsageAgg...
1.0.5 AzureRM.DataLakeAnalytics Module PSGallery Microsoft Azure PowerShell - Data Lak...
1.0.5 AzureRM.DataLakeStore Module PSGallery Microsoft Azure PowerShell - Data Lak...
1.0.6 AzureRM.RecoveryServices Module PSGallery Microsoft Azure PowerShell - Recovery...
1.0.5 AzureRM.NotificationHubs Module PSGallery Microsoft Azure PowerShell - Notifica...
1.0.1 AzureRM.LogicApp Module PSGallery Microsoft Azure PowerShell - LogicApp...
0.9.2 AzureRM.AzureStackAdmin Module PSGallery Microsoft Azure Stack Administration ...
0.9.3 AzureRM.AzureStackStorage Module PSGallery Microsoft Azure PowerShell - Storage ...
0.7.1.1 AzureRM.Profile.Dsc Module PSGallery DSC Resources for AzureRM.Profile

所以我正在寻找版本高于1.0.4的模块上的类似命令:

find-module -name "azurerm.*" -requiredversion 1.0.4 | install-module -force

或任何其他通过列表项执行 for-each 的 powershell 技巧

最佳答案

[Version] $cut = New-Object Version("1.0.4")
Find-Module -Name AzureRM.* | Where {$_.Version.CompareTo($cut) -eq 1}

这依赖于Version::CompareTo

关于powershell - 安装特定版本的 AzureRM.* 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36038746/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com