Now before we go,
I want to show you a few other things that you can work with in
PowerShell that might make it easy to find commands or to even just
navigate commands that you may have run.
Now, first off,
you can hit the up arrow at the prompt to go back and
find the commands that you ran before.
So if I want rerun that ping command,
I can just use the up arrow to go and find the commands.
There was also a little utility here in PowerShell that's part of a module
called PSReadLine, and they way that this works is I can press Ctrl+R and I get
this little search here, so it lets you know that I ran that Get‑Vegetable
command. And you can see as soon as I started typing Get, there we go, so there
is Get‑Verb, and if I wanted to, oh,
that's not what I want, I want the G, there we go, so I can go back
and I can find things with that Ctrl+R, very nice and quick and easy
to find cmdlets I may have run before without having to retype things.
Now, I also mentioned, you know,
you also have tab completion. So I can do Get‑Ser and hit Tab, and it
will auto complete, and Shift+Tab will go backwards.
So let's go back here to Get‑Service because another fun thing here,
the parameter name is ‑Name, that's the default.
So it knows if I hit Tab,
that's all I'm doing here, it is cycling through all
of the possible service names.
So there's a lot of cool things that PowerShell will do to
make your life easier, you just have to get in the habit of
using that tab completion.
It doesn't work all the time, but it does work quite a bit.
The last thing I want to show you here is another command called Show‑Command.
So if you run Show‑Command all by itself,
this will give you a GUI pop‑up of all the possible commands on
your system, it's very similar to the Get‑Command.
Now there's another nice benefit, though.
I'm going to fine tune this, and let's do Get‑Service.
Now I get all of the parameter sets, that's the technical term for
those different ways of using it, and I can say,
you know what, I want to find this by the, say DisplayName, and I want to find
all the ones that start with win*. You can either run the command, which will
paste it now into the command prompt, or I could have copied it so I could then
paste it into some script I'm working on.
You can also use Show‑Command right from the prompt here
and say I want to do Show‑Command, say Get‑Vegetable,
I'll use tab completion there.
Now, this doesn't have too many options here.
Let's say you know what, I just want to use that
RootOnly. Click Run, and there we go.
So I don't necessarily have to know all of the syntax, I can discover what the
syntax is by using that little GUI, the Show‑Command GUI, and pick and choose
what I need from those different options, and then PowerShell will display the
command with all the parameters that I need.
So it's a nice,
handy and easy way to learn about PowerShell and how to build these commands.
The more you spend time in PowerShell,
the easier it will be and the more fun you're going to have.
So, I think that's enough for looking at commands. Let's go back to the slides and wrap it all up.