Improve performance of Package identification
Using -ListAvailable with Get-Command to ensure no module loading is attampeted while querying loaded commands. This improved performance when certain modules have not been loaded yet
This commit is contained in:
parent
499a86baa6
commit
22aa3ba435
10 changed files with 17 additions and 17 deletions
|
@ -4,7 +4,7 @@ function RemoveAlias {
|
|||
param([string]$Name)
|
||||
$local:a = $Name | Where-Object { $_ } | Get-Alias -ErrorAction SilentlyContinue
|
||||
if ( -not $a ) { return }
|
||||
if ( Get-Command Remove-Alias -ErrorAction SilentlyContinue ) {
|
||||
if ( Get-Command -ListImported Remove-Alias -ErrorAction SilentlyContinue ) {
|
||||
$a | Remove-Alias -Scope $MyAliasScope -ErrorAction SilentlyContinue
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue