Reputation: 7476
I want to install a specific version of all of AzureRM.*
modules and since there are 26 of them I don't want to do it manually one by one:
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
so I am looking for a command like this on those modules which has a version greater than 1.0.4
:
find-module -name "azurerm.*" -requiredversion 1.0.4 | install-module -force
or any other powershell trick that do a for-each through the list items
Upvotes: 4
Views: 1387
Reputation: 809
[Version] $cut = New-Object Version("1.0.4")
Find-Module -Name AzureRM.* | Where {$_.Version.CompareTo($cut) -eq 1}
This relies on Version::CompareTo
Upvotes: 1