Skip to content

Commit 23aad2b

Browse files
authored
Replace Get-InstalledModule with Get-Module -ListAvailable (#20632)
1 parent 810d64f commit 23aad2b

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

tools/Az.Tools.Installer/Az.Tools.Installer.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ class ModuleInfo
399399
function Remove-AzureRM {
400400
process {
401401
try {
402-
$azureModuleNames = (Get-InstalledModule -Name Azure* -ErrorAction Stop).Name | Where-Object {$_ -match "Azure(\.[a-zA-Z0-9]+)?" -or $_ -match "AzureRM(\.[a-zA-Z0-9]+)?"}
402+
$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]+)?"}
403403
foreach ($moduleName in $azureModuleNames) {
404404
PowerShellGet\Uninstall-Module -Name $moduleName -AllVersion -AllowPrerelease -ErrorAction Continue
405405
}

tools/Az.Tools.Installer/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
## Upcoming Release
2+
* Remove the usage of `Get-InstalledModule` from product codes.
23
## 0.2.1
34
* Fixed the issue of installation and updating when Repository is not provided (#20209)
45
* Updated telemetry assembly to 2.13.1

0 commit comments

Comments
 (0)