Alright, so let's look at how to use help in a little more detail here.
So we know we can run a command like help get‑service,
and we can see PARAMETERS, and we'll also scroll down here,
you can see NOTES and all the examples.
Now this is the same behavior that you can get with the help
command that has a parameter called ‑full.
And this will show you everything that there is about help.
Now for some reason in PowerShell 7,
it looks like the new default is to show you full commands,
although I have seen some systems where it doesn't
always show full help all the time, and I can't figure out why that is.
So if you want to see full help, it doesn't hurt to run help,
the name the command, ‑full,
and then you'll know you'll always get the full help and examples.
Those examples are very important.
There is also an option here with the help command called ‑ShowWindow,
and when you run this, this will display the help,
and it doesn't always pop up here, but if I look behind here,
I have a graphical window, let's make this bigger.
What's nice here is that you can zoom in and make the font size bigger.
There is like search, so I wanted to say search for name,
you can say get some nice highlighting.
Now the output,
and the way that this is displayed may be different
than what you see on the screen, so the order isn't always the same,
and you can control or filter,
you know what types of help content that you want to see.
It's a really handy a little tool because you can do help ‑ShowWindow,
pull the window if you have multiple monitors,
pull this little display over to one monitor,
and then you have your other monitor to be working,
so you can look, you can look back and forth.
I find that really quite helpful.
I feel like there's lots of gotchas or potential
gotchas I got to tell you about, but yeah,
there are.
So one thing about the ‑ShowWindow is that,
remember I mentioned earlier that all the PowerShell help gets
formatted in these kind of fancy XML files.
When you do ‑ShowWindow, PowerShell kind of has to massage or reformat that
XML data to display properly in this graphical display.
Sometimes the XML gets a little mangled,
gets a little torqued,
and PowerShell, from the console, usually can display just fine, but
sometimes you'll get kind of weird things with help when you're using
‑ShowWindow. So just be aware of that. I think I have a demo of that a
little bit later. So let's close that, and let's come back to the prompt
here, and let's do help get‑process.
Here's another example, we can see I'm getting NAME, SYNTAX,
SYNOPSIS, DESCRIPTION, then all the parameters.
Well sometimes what you might want to do though,
is say, you know,
I don't need to see all that, I'm just curious about a particular
parameter. So you can run help name of the command, let's go back to
get‑service, say just show me all the name parameter.
Now I can see, and focus really just on that parameter.
So the name parameter specifies the service name of the service to be retrieved.
Okay, that seems pretty simple, and wild cards are allowed.
Now you can also,
with the ‑ parameter, you can also use wild cards
that actually, as part of the name.
So say hey,
for get‑service, show me all the parameters that are *name.
So, I can see I get ‑DisplayName and ‑Name.
So let's clear the screen here, and the last thing to show you here with get
help are the examples. You saw when you do ‑Full, you get all the examples, if
all you want to see are the examples, just do help,
the name the command, and then ‑Examples.
This then shows you, so it gives you the name of
synopsis, but then it will go through,
and PowerShell will display just the example.
So you can see how do I use this particular command.
That could be really quite handy.
Another potential gotcha though, the quality of the help and the number of those
examples really depend upon the team or the author who is responsible for that
cmdlet or the documentation. Now here's an example of a command that I have, I
expect you do too, enable‑storagebusdisk.
And if I do ‑full help, you can see there's the SYNTAX and PARAMETERS.
There's no DESCRIPTION, and there are no examples, so there's nothing I can do.
If I need more information about how to use this command,
I'm gonna have to go online and asking people, hey,
I don't understand this particular parameter or whatever because
the help documentation is not fully fleshed out.
It's unfortunate that some commands, for whatever reason,
don't have all the help that other commands do, but the only
way you're going to know that is by looking.
Just don't be surprised if you don't see what you are
expecting. Now PowerShell will generate pretty much basic help
based on command metadata and parameters,
so you should always at least be able to see, when you do help for a command,
even if has no documentation shipping with it, it should still at
least show you the syntax, so you can see what the parameters are
and how to use that particular command.
You just may not get all the extra bonuses with parameter information and examples.