Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions tools/Az.Tools.Installer/exports/Install-AzModule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,15 @@ function Install-AzModule {
}

if ($RemoveAzureRm -and ($PSCmdlet.ShouldProcess('Remove AzureRm modules', 'AzureRm modules', 'Remove'))) {
Uninstall-Module -Name 'AzureRm*' -AllVersion -ErrorAction SilentlyContinue
Uninstall-Module -Name 'Azure.*' -AllVersion -ErrorAction SilentlyContinue
try {
$azureModuleNames = (Get-InstalledModule -Name Azure* -ErrorAction Stop).Name | Where-Object {$_ -match "Azure(\.[a-zA-Z0-9]+)?$" -or $_ -match "AzureRM(\.[a-zA-Z0-9]+)?$"}
foreach($azureModuleName in $azureModuleNames) {
Uninstall-Module -Name $azureModuleName -AllVersion -ErrorAction SilentlyContinue
}
}
catch {
Write-Warning $_
}
}

#install Az.Accounts first
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function Get-AzModuleUpdateList {

if ($installModules.Keys -gt 0) {
foreach ($key in $installModules.Keys.Clone()) {
$installedModules = (PowerShellGet\Get-InstalledModule -Name $key -AllVersions).Where( { -not $_.AdditionalMetadata.IsPrerelease })
$installedModules = (PowerShellGet\Get-InstalledModule -Name $key -AllVersions) | Where-Object { -not $_.AdditionalMetadata.IsPrerelease }
foreach ($installed in $installedModules) {
$installModules[$key] += [System.Tuple]::Create($installed.Version, $installed.Repository)
}
Expand Down