PowerShell: Get-Alias

Aaaaand we’re back! I hope I’m not the only one impressed with how fast I am knocking these bad boys out. Wanna learn more about PowerShell’s Alias command? Then I suggest you keep on reading.

What’s an Alias? By definition an alias is an alternate name for someone or something. Now we got that out of the way. Have you ever used this or seen it?

I personally try not to use them in this blog or in my professional scripts. Alias confuses new PowerShell users, or people trying to understand the code. Currently there is only 158 alias Get-Alias | Select Name | measure, but as written here in the post Get-Command, there is a total of 1,495 cmdlets, and I do not expect a novice PowerShell user to remember all the alias and Cmdlets. I think using alias saves a lot of time, but for the purpose of this blog we will not use them at this stage. If you search around the internet you will notice a lot of scripts with aliases, and the purpose of this post is to give you the tools to find the Alias.

A few things you need to know about the danger of using aliases. PowerShell version 2.0 doesn’t allow aliases, but you can still create aliases in 2.0. That brings me to my next point, if you take a script from the internet – make sure you know what it does. Some people have profiles and custom alias configured, and if you fail to remember to check for it, you could experience unknown issues. At this current stage, I wouldn’t worry about using aliases, but it is good to understand they exist.
There’s two ways to get the alias list:

Get-Alias

and

gal

If we want to find a list cmdlets that start with ‘Get’ and have an Alias that start with ‘G’, then we need to use the following:

Get-Alias -name G*

Here is the current list of 158 Alias.
Get-Alias | Select Name
%
?
ac
asnp
cat
cd
CFS
chdir
clc
clear
clhy
cli
clp
cls
clv
cnsn
compare
copy
cp
cpi
cpp
curl
cvpa
dbp
del
diff
dir
dnsn
ebp
echo
epal
epcsv
epsn
erase
etsn
exsn
fc
fhx
fl
foreach
ft
fw
gal
gbp
gc
gcb
gci
gcm
gcs
gdr
ghy
gi
gin
gjb
gl
gm
gmo
gp
gps
gpv
group
gsn
gsnp
gsv
gtz
gu
gv
gwmi
h
history
icm
iex
ihy
ii
ipal
ipcsv
ipmo
ipsn
irm
ise
iwmi
iwr
kill
lp
ls
man
md
measure
mi
mount
move
mp
mv
nal
ndr
ni
nmo
npssc
nsn
nv
ogv
oh
popd
ps
pushd
pwd
r
rbp
rcjb
rcsn
rd
rdr
ren
ri
rjb
rm
rmdir
rmo
rni
rnp
rp
rsn
rsnp
rujb
rv
rvpa
rwmi
sajb
sal
saps
sasv
sbp
sc
scb
select
set
shcm
si
sl
sleep
sls
sort
sp
spjb
spps
spsv
start
stz
sujb
sv
swmi
tee
trcm
type
wget
where
wjb
write

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s