>> Hello, everyone. I'm instructor Jerry Roberts,
and this is PowerShell scripting.
Now, sometimes when you're working in PowerShell,
you might need a little bit of assistance.
In this module, we're going to
talk about how to get that.
We're going to talk about getting help in PowerShell.
We're going to talk about the helps syntax,
some information about parameters and piping,
some helpful hints to help you along your way.
Then we're going to switch a little bit
over to PowerShell ISE.
Then last but not least,
we're going to talk about some
additional help that you can get.
Getting help in PowerShell.
There are three commands in PowerShell
that you can actually use to get some help.
There is Get-Help,
help, and man.
Get-Help is a built in
CMD let that allows
you to get information about a command.
Help is actually a built-in function
you can use to get information about the command.
Man is actually just an alias for help.
Does the exact same thing as help,
only it's the Linux friendly version.
If you're used to working in Linux,
you have your man command here as well.
The syntax for help.
When you run a help command,
you actually get a couple different things
that are returned about the command you're looking up.
There is a section in here called syntax.
This is actually very important
because it helps you understand how
to use the command and how it's actually written out.
You'll see in the picture here,
there's a lot of stuff.
You'll see get-command,
which was the one we looked for help for.
You'll see a lot of
different parameters and other things like -Name,
-Argument list, and so forth.
Any items in
the square brackets are considered perimeters.
Again, -Name,
-Argument list, -All, et cetera.
Items in the less than,
greater than brackets are objects or parameter values.
You can see here under name,
it can take a string.
You can put in values in,
say, words or sentences.
Items in the curly Q brackets are usually
a list of items that can be valid parameters.
If you look at command type,
you'll see you have alias, function,
filter, all those other
things that you can put it in there.
Items separated by a pipe,
a representative of multiple items
in a valid parameter list.
Again, when you look at command type,
you can see alias, function, filter,
etc that could all be
valid values for that particular parameter.
Couple other things about parameters.
The help documentation actually
does include some more robust information,
not just that little list there that can
tell you what parameters are available.
This information helps you better
understand what the parameters are.
That understanding does help you write
better commands and scripts to do
>> things you want to do.
>> If you want to see more information about
a parameter when you're doing
the help command or the Get-Help or man,
at the end of the command,
do the dash full switch
and this will give you a lot more information.
Some things you'll see when you pull up parameters.
How you'll actually see datatype.
This is just what kind of information it can take.
For example, when we talked earlier about string,
that just means it takes in a string of values such as
a word of sentence required.
That means you have to provide a value
for that parameter in order for the command to work.
If it says required,
yes, that means you need to put something there.
Position. Now, one of the things about commands in
PowerShell is in some cases
you don't have to provide the parameter name.
If a value is provided in
a certain position in the command,
the system automatically knows what
that parameter is and doesn't need the name.
Now, that's not all commands and not all parameters.
Be wary of that.
Default value.
Sometimes PowerShell will fill
in a default value for a parameter.
If there is one, it will show this in
the description and give you further information.
Another couple of things here that have more
to do with how the command works,
except pipeline input and accept wildcard characters.
Pipeline input means whether or not you can
actually pipe something with the command.
Some commands don't let you use a pipe.
The wildcard, whether or not you can
use wildcards for parameter values,
that could be percentages or
asterisks or things like that.
In some cases you can use
wildcards that does help you find things.
In other cases, it won't let you use a wildcard,
so you have to use the full value.
What actually is a pipe?
Wildcards are pretty easy to understand,
but pipes are a little bit
more complex when it comes to commands.
According to Microsoft, pipelines act
like a series of connected segments of a pipe.
Items moving along the pipeline
pass through each segment.
To create a pipeline in PowerShell,
you connect the commands together with
>> the pipe operator,
>> which is the up and down line.
The output of each command is used as input for
the next command. What does that all be?
Basically, it just means pipes are
going to allow you to use multiple commands together.
Each command takes the output from
>> the previous command.
>> An important thing to understand is
that command is not going to
take the text from the previous command,
it's going to be the output from the previous command.
For example, Get-Printers pipe FL.
The command there is going to get all of the printers,
then it's going to format it in a list.
What will happen is that FL there,
that formatted list is going to grab
everything from Get-Printers and
make a pretty little list for you.
Some helpful hints when working in PowerShell.
Use the up arrow to
enumerate the commands you've previously done.
This is very similar to some other
>> command line systems.
>> All you do is up or down and you can
scroll through what you've already written.
Use the clear command
to clear out your PowerShell windows.
If you type the word clear,
it'll clear everything out and you'll
start with a nice, clean PowerShell window.
You can also use a Tab key
to complete commands or Tab complete.
This is not 100 percent accurate, however,
it's fairly accurate and works pretty similar if
you're used to the Cisco IOS system
or other systems like that,
where you start to type a command
and you use the Tab key.
Now, what it'll do on
regular PowerShell is when you hit "Tab" and it'll
allow you to scroll through
commands that are similar to what you're typing.
Now, when we get to PowerShell ISE,
it's a little different.
There are actually some better helpful things.
Their first helpful item is the
>> PowerShell IntelliSense.
>> Now, if you've worked with Visual Studio
or some other products,
you might be familiar with IntelliSense.
Basically, as a code completion aid
supposed to help you complete
commands in a visual way instead of having
to tab through using tab complete.
You can see on the right-hand side here this picture
where we're trying to get to command.
It shows us a list of what kind
of Get commands we can use.
When you start typing more,
it actually does make the list shorter because
it'll find what you're exactly starting to type.
When on, it's going to
display that list based on what you typed.
You can see there, I only typed
get- so there's a whole lot of commands.
Again, if I started typing a little more,
that list would tighten up.
Another item is the command search.
This is actually a really cool item
that they have in PowerShell ISE.
This allows you to search for
a command through a list of commands.
Pretty much you start typing the command as you can see
here on the right and they'll
give you a nice little list.
This is nice because if you can't
remember exactly what a command is,
you can actually type
different words in the command and will find it.
Instead of just IntelliSense that finds
it based on what you've started typing,
if you were to type just a word, for example, here,
if you were to type alias,
you would get a list of
all the commands that had the word alias in it
instead of IntelliSense where you just
did get-a and it found it that way.
It's very useful.
Allows you to do keyword searches and things
like that so you can find commands little bit easier.
If you want to use it in ISE,
you go to View and show command add on,
and it shows up on the right.
It's very useful.
Additional help with PowerShell.
You do have about files that
you can access in PowerShell.
There's also a couple of
parameters ShowWindow and ShowCommand.
Give you some more information
about what you're working with.
The Microsoft Docs website is
super useful for getting help as well.
That's https://docs.microsoft.com/en-us/powershell.
Again,
if you're in another country,
go to your Countries
Landing page for Microsoft documents,
which is usually just docs.Microsoft.com.
Then type in PowerShell and it should bring you
directly to the PowerShell page.
It's post assessment time.
If you wanted to get help for the Get-ADGroup command,
what command would you use?
Would you use help Get-ADGroup, man Get-ADGroup,
or Get-Help, Get-ADGroup,
or would it be all of those above?
You can go ahead and pause for a second.
Then once you're ready, we'll get the answer.
The answer is actually all of the above.
Help man and Get-Help are all
valid commands you can use to get
information about a command.
In this video, we talked
a little bit about how to get help for PowerShell.