Finding Invalid Aliases

Share |

Join PowerShell.com!
Subscribe to Feed

PowerShell eBook
Sign up for
Your PowerTip of the Day:

Award-winning PowerShellPlus


Admin Guide to PowerShell Remoting


Mastering PowerShell eBook

When you create new Aliases with Set-Alias, PowerShell does not check whether the target you specify is valid. Instead, this is checked only when you use the alias. This line can help you to find all aliases with invalid targets:

Get-Alias | ForEach-Object {
if (!(Get-Command $_.Definition -ea SilentlyContinue)) {$_}}

If it returns nothing, then all is fine.

Twitter This Tip! ReTweet this Tip!


Posted Apr 22 2010, 08:00 AM by ps1

Comments

Twitter Trackbacks for Finding Invalid Aliases - Power Tips - PowerShell.com [powershell.com] on Topsy.com wrote Twitter Trackbacks for Finding Invalid Aliases - Power Tips - PowerShell.com [powershell.com] on Topsy.com
on 04-22-2010 10:24 AM

Pingback from  Twitter Trackbacks for                 Finding Invalid Aliases - Power Tips - PowerShell.com         [powershell.com]        on Topsy.com

Bad Credit Mortgage Application | Find Free Trial | Mortgage Finance Wisdom wrote Bad Credit Mortgage Application | Find Free Trial | Mortgage Finance Wisdom
on 04-30-2010 7:07 AM

Pingback from  Bad Credit Mortgage Application | Find Free Trial | Mortgage Finance Wisdom

Copyright 2012 PowerShell.com. All rights reserved.