Conflicting Commands

by Jun 25, 2009

PowerShell supports many different command categories and searches for the command in the following order:

1. Alias
2. Function
3. Cmdlet
4. Executable
5. Script
6. Associated Files

This enables you to override existing commands. For example, if you define an alias named ping, you would no longer have access to ping.exe when you simply type in ping:

Set-Alias ping notepad.exe

However, you could still call the original ping.exe command when you specify its extension:


To list all conflicting commands, use this:

Get-Command -type cmdlet,function,alias | Group-Object name | Where-Object { $_.Count -gt 1 } | ForEach-Object { $_.Group }