With all of this in mind,
let's jump into a PowerShell 7 session, and you'll see how
easy it is to run and work with commands.
All right, so I'm in Windows PowerShell,
and I am using Windows Terminal just because I think that's
the modern way to be using PowerShell.
And for me, it's a nice, easier way to work.
And just to show you, I'll show you the PSVersionTable,
and I am running the latest version, 7.1.2, your version obviously may differ,
and hopefully you are running at least this version of PowerShell to
line up everything that I'm going to be showing you.
So we'll start with Get‑Command. Get‑Command will show me all of
the commands that are available on my system.
Now you can see that scroll by there pretty quickly.
I can refine this by doing Get‑Command and specify the command types,
such as cmdlet and function. And in this case, this is pretty much
going to give me the same. In Windows PowerShell, I believe the
default gave you lots more information, and in PowerShell 7 they have
kind of fine‑tuned that, but if you want to take real control over
what shows up,
you can use that command‑type parameter. So you can get a
command even if you know part of the name.
Like say, hey,
I want to show all the commands that have disk in the name, so you can use the
wildcard character. There you can see some applications.
Those are the commands that are in the system path, programs, or applications,
not necessarily PowerShell tools.
So let's refine the command. Let's clear the screen here,
and let's do Get‑Command, and again,
just the disk commands, and I'll limit it to cmdlets and functions.
Now my list gets a little bit shorter,
and I can kind of continue to refine to find the command that I am looking for.
Now, as I mentioned, commands follow a standard naming convention using verbs.
We can get those verbs with the Get‑Verb cmdlet,
and I'll pipe that to more because this is going to scroll a number of things.
You can hit the Spacebar to go to the next page, Enter
just goes one line, or Q to quit.
I'm just going to quit out of that list. So you can see all
of the verbs that are available to me.
So let's say I want to find all the commands that have
mount as the verb. Get‑Command ‑Verb Mount.
Pretty cool.
So there we go. So I can find what I'm looking for if I have
an idea about the name or the verb. Like, I can do a similar
thing, by the way, with the noun.
If I say, now that I've looked through earlier, I saw,
oh,
disk image seems to be a noun, what are all the
things that I can do with that noun?
All right, so I can dismount, get, or mount.
And this,
too, will allow you to use wildcards. So I can say show me all of the ones
where the noun starts with disk, so it will be DiskImage,
and then whatever else.
So there you go.
So I've got DiskImage, I've got Disk, I've got DiskSNV, lots of other options there.