Skip to content

Commit d682b93

Browse files
Enhance error handling in Remove-PSModule.ps1 by adding -ErrorAction SilentlyContinue to Get-InstalledPSResource
1 parent da8dadb commit d682b93

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scripts/helpers/Remove-PSModule.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
Write-Host " - Removing command [$($command.Name)]"
3434
$command | Remove-Item -Force
3535
}
36-
$installedModule = Get-InstalledPSResource | Where-Object { $_.Name -eq $Name }
36+
$installedModule = Get-InstalledPSResource -ErrorAction SilentlyContinue | Where-Object { $_.Name -eq $Name }
3737
Write-Host " - Found [$($installedModule.Count)] installed modules to remove"
3838
foreach ($module in $installedModule) {
3939
Write-Host " - Uninstalling module [$($module.Name)]"

0 commit comments

Comments
 (0)