diff --git a/tools/Az.Tools.Installer/Az.Tools.Installer.psd1 b/tools/Az.Tools.Installer/Az.Tools.Installer.psd1 index 6be43cf4c923..12df26fde760 100644 --- a/tools/Az.Tools.Installer/Az.Tools.Installer.psd1 +++ b/tools/Az.Tools.Installer/Az.Tools.Installer.psd1 @@ -109,8 +109,8 @@ # IconUri = '' # ReleaseNotes of this module - ReleaseNotes = '* Fix wildcard error in Install-AzModule - * Fix syntax errors in Windows Powershell' + ReleaseNotes = '* Fix bugs for Install-AzModule + * Fix syntax errors when run in Windows Powershell' # Prerelease string of this module # Prerelease = '' diff --git a/tools/Az.Tools.Installer/exports/Install-AzModule.ps1 b/tools/Az.Tools.Installer/exports/Install-AzModule.ps1 index bc33ab7fdb70..88ca708eca6d 100644 --- a/tools/Az.Tools.Installer/exports/Install-AzModule.ps1 +++ b/tools/Az.Tools.Installer/exports/Install-AzModule.ps1 @@ -257,6 +257,9 @@ function Install-AzModule { $parameter.Add('RequiredVersion', $module['Az.Accounts']) $module.Remove('Az.Accounts') } + if ($RemovePrevious) { + Uninstall-Module -Name Az.Accounts -AllVersion -ErrorAction SilentlyContinue + } Install-Module @parameter $module.Keys | Foreach-Object {