All right, so let's now try to run some commands.
So we know I have that vegetable command that we saw earlier, so let's go
ahead and try to run Get‑Vegetable. Now, I have no idea necessarily what
this might do, but it's a Get‑Command so it really can't do too much
damage, so let's just find out. Okay, nothing too exciting there, it
displays a list of vegetables.
But once I know the pattern, let's try again with the real command,
like Get‑Service.
Sure enough, I get a list of services. Now if I want to, from looking at help,
which eventually you'll learn how to use, I can say get me the bits
service. So that retrieves just a single service.
Let's real quickly look at help for Get‑Service,
and you can see there that there is a ‑Name parameter,
and there's also a ‑DisplayName parameter.
The Name parameter, as you can see there, it's in square brackets,
which means it is positional. DisplayName is not in square brackets,
which means if I want to use it,
I have to actually type the name of the parameter, and then we can
see all the other information about the cmdlet.
So let's do Get‑Service and we'll go ahead and explicitly use the ‑Name. It
works just fine, and in some ways that's a little nice because I know
exactly what it is that PowerShell wants to do.
But I could also use the DisplayName parameter and find me all the services
that have micro* as part of the DisplayName, and it turned out that works as
you would expect. I want to point out, by the way,
that PowerShell is a shell, so I can run other tools
as well, even command line tools.
I can run things like tasklist, the command line way of looking at processes.
I can ping things. So the ping command will work.
I'm just going to ping the localhost.
I can use stuff like nslookup and try to resolve a DNS name, that works as well.
Now,
eventually you'll learn the PowerShell equivalents for those commands, but
if you need or rely on those commands to do your job,
you can do them right from PowerShell.
In fact,
you can use PowerShell's Run‑Any command once you know the command line for it.
For example,
I can run Notepad, or if I wanted to I can open up the Control
Panel because I know that that is control.
So I can navigate through a lot of my Windows stuff right from PowerShell.
Personally,
I use a PowerShell window all the time to do everything
that I need to do throughout my day,
I have learned all the command line tools, so I just find it faster to
just type the command than to go searching for it through the start
panel or shortcuts or anything like that. I just type it out and I'm good to go.