AvoidGlobalAliases
Severity Level: Warning
Description
Globally scoped aliases override existing aliases within the sessions with matching names. This name collision can cause difficult to debug issues for consumers of modules and scripts.
To understand more about scoping, see Get-Help about_Scopes
.
NOTE This rule is not available in PowerShell version 3 or 4 because it uses the
StaticParameterBinder.BindCommand
API.
How
Use other scope modifiers for new aliases.
Example
Wrong
New-Alias -Name Name -Value Value -Scope Global
Correct
New-Alias -Name Name1 -Value Value
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for