A few years ago, I accidently stumbled upon an "hidden" PowerShell alias in VMware PowerCLI, vc
, which can be used instead of Connect-ViServer
.
This vc
command is invisible to both Get-Command
and Get-Alias
, it's not recognized by command completion (not that you really need it to), and I could only relate it to Connect-ViServer
by its output and behavior.
I found this specific pseudo-alias to be pretty useful in my PowerCLI work, and I always wondered how this worked, and whether there were other such hidden shortcuts.
Today, I searched my system for 2-letter and 3-letter commands unknown to Get-Command, and the only ones that came out beside vc
were shortened Get-* commands (as explained by @vrdse below).
vc
pseudo-alias is defined ?Here's my (quick and dirty) script for 3-letter aliases, which ran for about an hour (!) on my system, and found nothing but shortened Get-* commands :
(Caution: blindly running random commands as I did is NOT recommended)
$az = [char[]]('a'[0]..'z'[0])
foreach ($i in $az) {
write $i
foreach ($j in $az) {
write $i$j
foreach ($k in $az) {
if (!(gcm -ea ig $i$j$k)) {
try {iex $i$j$k; write-warning $i$j$k} catch {}
}
}
}
}
As I stated already in the comments, PowerShell doesn't require the Get-
of Get-*
commands, such as Get-Vhd
. Instead, you can just type Vhd
. That being said, you can check for aliases for Connect-ViServer
.
Get-Alias -Definition Connect-ViServer
----------- ----
Alias Get-ESX
Alias Get-VC
Alias Get-VIServer
You see, that in fact there are some aliases to it. One of which is Get-VC
, thus vc
is possible.