Skip to content

Commit

Permalink
Replace Get-InstalledModule with Get-Module -ListAvailable (#20632)
Browse files Browse the repository at this point in the history
  • Loading branch information
msJinLei authored Jan 30, 2023
1 parent 810d64f commit 23aad2b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tools/Az.Tools.Installer/Az.Tools.Installer.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ class ModuleInfo
function Remove-AzureRM {
process {
try {
$azureModuleNames = (Get-InstalledModule -Name Azure* -ErrorAction Stop).Name | Where-Object {$_ -match "Azure(\.[a-zA-Z0-9]+)?" -or $_ -match "AzureRM(\.[a-zA-Z0-9]+)?"}
$azureModuleNames = (Microsoft.PowerShell.Core\Get-Module -ListAvailable -Name Azure* -ErrorAction Stop).Name | Where-Object {$_ -match "Azure(\.[a-zA-Z0-9]+)?" -or $_ -match "AzureRM(\.[a-zA-Z0-9]+)?"}
foreach ($moduleName in $azureModuleNames) {
PowerShellGet\Uninstall-Module -Name $moduleName -AllVersion -AllowPrerelease -ErrorAction Continue
}
Expand Down
1 change: 1 addition & 0 deletions tools/Az.Tools.Installer/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## Upcoming Release
* Remove the usage of `Get-InstalledModule` from product codes.
## 0.2.1
* Fixed the issue of installation and updating when Repository is not provided (#20209)
* Updated telemetry assembly to 2.13.1
Expand Down

0 comments on commit 23aad2b

Please sign in to comment.