WEBVTT

00:00.000 --> 00:03.300
>> Hello, everyone. I'm
instructor Jerry Roberts,

00:03.300 --> 00:05.655
and this is
PowerShell scripting.

00:05.655 --> 00:08.370
Now, sometimes when you're
working in PowerShell,

00:08.370 --> 00:10.650
you might need a little
bit of assistance.

00:10.650 --> 00:11.820
In this module, we're going to

00:11.820 --> 00:13.470
talk about how to get that.

00:13.470 --> 00:16.050
We're going to talk about
getting help in PowerShell.

00:16.050 --> 00:18.330
We're going to talk
about the helps syntax,

00:18.330 --> 00:22.015
some information about
parameters and piping,

00:22.015 --> 00:25.080
some helpful hints to
help you along your way.

00:25.080 --> 00:27.105
Then we're going to
switch a little bit

00:27.105 --> 00:29.430
over to PowerShell ISE.

00:29.430 --> 00:31.620
Then last but not least,

00:31.620 --> 00:32.640
we're going to talk about some

00:32.640 --> 00:35.020
additional help
that you can get.

00:35.540 --> 00:38.190
Getting help in PowerShell.

00:38.190 --> 00:39.630
There are three
commands in PowerShell

00:39.630 --> 00:41.580
that you can actually
use to get some help.

00:41.580 --> 00:43.485
There is Get-Help,

00:43.485 --> 00:45.510
help, and man.

00:45.510 --> 00:48.260
Get-Help is a built in

00:48.260 --> 00:50.180
CMD let that allows

00:50.180 --> 00:52.585
you to get information
about a command.

00:52.585 --> 00:55.879
Help is actually a
built-in function

00:55.879 --> 00:58.900
you can use to get information
about the command.

00:58.900 --> 01:02.180
Man is actually just
an alias for help.

01:02.180 --> 01:04.325
Does the exact same
thing as help,

01:04.325 --> 01:06.920
only it's the Linux
friendly version.

01:06.920 --> 01:08.900
If you're used to
working in Linux,

01:08.900 --> 01:12.355
you have your man
command here as well.

01:12.355 --> 01:15.210
The syntax for help.

01:15.210 --> 01:17.555
When you run a help command,

01:17.555 --> 01:21.995
you actually get a
couple different things

01:21.995 --> 01:25.870
that are returned about the
command you're looking up.

01:25.870 --> 01:29.285
There is a section in
here called syntax.

01:29.285 --> 01:31.010
This is actually very important

01:31.010 --> 01:32.840
because it helps
you understand how

01:32.840 --> 01:36.820
to use the command and how
it's actually written out.

01:36.820 --> 01:40.085
You'll see in the picture here,

01:40.085 --> 01:41.960
there's a lot of stuff.

01:41.960 --> 01:44.630
You'll see get-command,

01:44.630 --> 01:47.645
which was the one we
looked for help for.

01:47.645 --> 01:49.250
You'll see a lot of

01:49.250 --> 01:53.240
different parameters and
other things like -Name,

01:53.240 --> 01:56.605
-Argument list, and so forth.

01:56.605 --> 01:58.700
Any items in

01:58.700 --> 02:02.570
the square brackets are
considered perimeters.

02:02.570 --> 02:04.175
Again, -Name,

02:04.175 --> 02:07.330
-Argument list, -All, et cetera.

02:07.330 --> 02:09.815
Items in the less than,

02:09.815 --> 02:14.330
greater than brackets are
objects or parameter values.

02:14.330 --> 02:17.390
You can see here under name,

02:17.390 --> 02:19.795
it can take a string.

02:19.795 --> 02:22.235
You can put in values in,

02:22.235 --> 02:25.970
say, words or sentences.

02:25.970 --> 02:28.880
Items in the curly Q
brackets are usually

02:28.880 --> 02:32.470
a list of items that can
be valid parameters.

02:32.470 --> 02:35.405
If you look at command type,

02:35.405 --> 02:37.880
you'll see you have
alias, function,

02:37.880 --> 02:39.140
filter, all those other

02:39.140 --> 02:40.990
things that you can
put it in there.

02:40.990 --> 02:43.450
Items separated by a pipe,

02:43.450 --> 02:45.865
a representative
of multiple items

02:45.865 --> 02:48.200
in a valid parameter list.

02:48.200 --> 02:50.560
Again, when you look
at command type,

02:50.560 --> 02:52.585
you can see alias,
function, filter,

02:52.585 --> 02:54.610
etc that could all be

02:54.610 --> 02:58.030
valid values for that
particular parameter.

02:58.030 --> 03:01.930
Couple other things
about parameters.

03:01.930 --> 03:04.540
The help documentation actually

03:04.540 --> 03:07.120
does include some more
robust information,

03:07.120 --> 03:08.830
not just that little
list there that can

03:08.830 --> 03:11.545
tell you what parameters
are available.

03:11.545 --> 03:14.260
This information
helps you better

03:14.260 --> 03:16.700
understand what the
parameters are.

03:16.700 --> 03:19.585
That understanding
does help you write

03:19.585 --> 03:21.940
better commands
and scripts to do

03:21.940 --> 03:23.454
>> things you want to do.

03:23.454 --> 03:26.380
>> If you want to see
more information about

03:26.380 --> 03:28.690
a parameter when you're doing

03:28.690 --> 03:31.570
the help command or
the Get-Help or man,

03:31.570 --> 03:33.715
at the end of the command,

03:33.715 --> 03:36.105
do the dash full switch

03:36.105 --> 03:38.475
and this will give you
a lot more information.

03:38.475 --> 03:42.045
Some things you'll see when
you pull up parameters.

03:42.045 --> 03:43.690
How you'll actually
see datatype.

03:43.690 --> 03:46.000
This is just what kind of
information it can take.

03:46.000 --> 03:48.490
For example, when we talked
earlier about string,

03:48.490 --> 03:50.890
that just means it takes in
a string of values such as

03:50.890 --> 03:53.710
a word of sentence required.

03:53.710 --> 03:56.260
That means you have
to provide a value

03:56.260 --> 03:58.630
for that parameter in order
for the command to work.

03:58.630 --> 04:00.280
If it says required,

04:00.280 --> 04:02.635
yes, that means you need
to put something there.

04:02.635 --> 04:07.070
Position. Now, one of the
things about commands in

04:07.070 --> 04:09.320
PowerShell is in some cases

04:09.320 --> 04:11.945
you don't have to provide
the parameter name.

04:11.945 --> 04:14.150
If a value is provided in

04:14.150 --> 04:16.985
a certain position
in the command,

04:16.985 --> 04:19.820
the system automatically
knows what

04:19.820 --> 04:23.180
that parameter is and
doesn't need the name.

04:23.180 --> 04:28.715
Now, that's not all commands
and not all parameters.

04:28.715 --> 04:30.905
Be wary of that.

04:30.905 --> 04:32.605
Default value.

04:32.605 --> 04:34.730
Sometimes PowerShell will fill

04:34.730 --> 04:37.040
in a default value
for a parameter.

04:37.040 --> 04:39.620
If there is one, it
will show this in

04:39.620 --> 04:42.605
the description and give
you further information.

04:42.605 --> 04:45.800
Another couple of things
here that have more

04:45.800 --> 04:48.875
to do with how the
command works,

04:48.875 --> 04:52.625
except pipeline input and
accept wildcard characters.

04:52.625 --> 04:54.830
Pipeline input means
whether or not you can

04:54.830 --> 04:56.975
actually pipe something
with the command.

04:56.975 --> 04:59.395
Some commands don't
let you use a pipe.

04:59.395 --> 05:01.940
The wildcard, whether
or not you can

05:01.940 --> 05:04.190
use wildcards for
parameter values,

05:04.190 --> 05:05.990
that could be percentages or

05:05.990 --> 05:07.930
asterisks or things like that.

05:07.930 --> 05:09.980
In some cases you can use

05:09.980 --> 05:12.470
wildcards that does
help you find things.

05:12.470 --> 05:16.159
In other cases, it won't
let you use a wildcard,

05:16.159 --> 05:18.900
so you have to use
the full value.

05:19.240 --> 05:22.070
What actually is a pipe?

05:22.070 --> 05:24.380
Wildcards are pretty
easy to understand,

05:24.380 --> 05:26.075
but pipes are a little bit

05:26.075 --> 05:30.635
more complex when it
comes to commands.

05:30.635 --> 05:33.590
According to Microsoft,
pipelines act

05:33.590 --> 05:36.365
like a series of connected
segments of a pipe.

05:36.365 --> 05:38.300
Items moving along the pipeline

05:38.300 --> 05:39.965
pass through each segment.

05:39.965 --> 05:41.810
To create a pipeline
in PowerShell,

05:41.810 --> 05:43.310
you connect the
commands together with

05:43.310 --> 05:44.480
>> the pipe operator,

05:44.480 --> 05:46.870
>> which is the
up and down line.

05:46.870 --> 05:49.940
The output of each command
is used as input for

05:49.940 --> 05:53.100
the next command. What
does that all be?

05:53.100 --> 05:55.730
Basically, it just
means pipes are

05:55.730 --> 05:58.580
going to allow you to use
multiple commands together.

05:58.580 --> 06:01.370
Each command takes
the output from

06:01.370 --> 06:02.710
>> the previous command.

06:02.710 --> 06:05.570
>> An important thing
to understand is

06:05.570 --> 06:07.640
that command is not going to

06:07.640 --> 06:10.590
take the text from
the previous command,

06:10.590 --> 06:13.490
it's going to be the output
from the previous command.

06:13.490 --> 06:19.830
For example,
Get-Printers pipe FL.

06:19.830 --> 06:24.244
The command there is going
to get all of the printers,

06:24.244 --> 06:27.350
then it's going to
format it in a list.

06:27.350 --> 06:30.035
What will happen
is that FL there,

06:30.035 --> 06:32.780
that formatted list
is going to grab

06:32.780 --> 06:34.340
everything from Get-Printers and

06:34.340 --> 06:36.200
make a pretty little
list for you.

06:36.200 --> 06:40.205
Some helpful hints when
working in PowerShell.

06:40.205 --> 06:41.840
Use the up arrow to

06:41.840 --> 06:44.495
enumerate the commands
you've previously done.

06:44.495 --> 06:46.610
This is very similar
to some other

06:46.610 --> 06:48.394
>> command line systems.

06:48.394 --> 06:50.600
>> All you do is up
or down and you can

06:50.600 --> 06:53.075
scroll through what
you've already written.

06:53.075 --> 06:55.040
Use the clear command

06:55.040 --> 06:56.660
to clear out your
PowerShell windows.

06:56.660 --> 06:58.220
If you type the word clear,

06:58.220 --> 06:59.750
it'll clear everything
out and you'll

06:59.750 --> 07:02.255
start with a nice, clean
PowerShell window.

07:02.255 --> 07:04.970
You can also use a Tab key

07:04.970 --> 07:07.735
to complete commands
or Tab complete.

07:07.735 --> 07:11.670
This is not 100 percent
accurate, however,

07:11.670 --> 07:16.130
it's fairly accurate and
works pretty similar if

07:16.130 --> 07:19.205
you're used to the
Cisco IOS system

07:19.205 --> 07:20.795
or other systems like that,

07:20.795 --> 07:22.400
where you start
to type a command

07:22.400 --> 07:24.065
and you use the Tab key.

07:24.065 --> 07:26.225
Now, what it'll do on

07:26.225 --> 07:28.940
regular PowerShell is when
you hit "Tab" and it'll

07:28.940 --> 07:30.380
allow you to scroll through

07:30.380 --> 07:34.325
commands that are similar
to what you're typing.

07:34.325 --> 07:37.415
Now, when we get
to PowerShell ISE,

07:37.415 --> 07:39.230
it's a little different.

07:39.230 --> 07:41.780
There are actually some
better helpful things.

07:41.780 --> 07:45.230
Their first helpful item is the

07:45.230 --> 07:48.639
>> PowerShell IntelliSense.

07:48.639 --> 07:50.630
>> Now, if you've worked
with Visual Studio

07:50.630 --> 07:51.860
or some other products,

07:51.860 --> 07:54.535
you might be familiar
with IntelliSense.

07:54.535 --> 07:57.095
Basically, as a
code completion aid

07:57.095 --> 07:58.400
supposed to help you complete

07:58.400 --> 08:00.290
commands in a visual
way instead of having

08:00.290 --> 08:02.390
to tab through
using tab complete.

08:02.390 --> 08:05.000
You can see on the right-hand
side here this picture

08:05.000 --> 08:08.000
where we're trying
to get to command.

08:08.000 --> 08:09.890
It shows us a list of what kind

08:09.890 --> 08:11.770
of Get commands we can use.

08:11.770 --> 08:13.755
When you start typing more,

08:13.755 --> 08:17.360
it actually does make
the list shorter because

08:17.360 --> 08:21.665
it'll find what you're
exactly starting to type.

08:21.665 --> 08:24.170
When on, it's going to

08:24.170 --> 08:26.660
display that list based
on what you typed.

08:26.660 --> 08:28.670
You can see there, I only typed

08:28.670 --> 08:31.715
get- so there's a
whole lot of commands.

08:31.715 --> 08:33.920
Again, if I started
typing a little more,

08:33.920 --> 08:35.750
that list would tighten up.

08:35.750 --> 08:39.870
Another item is the
command search.

08:39.870 --> 08:42.350
This is actually a
really cool item

08:42.350 --> 08:44.610
that they have in
PowerShell ISE.

08:44.610 --> 08:46.400
This allows you to search for

08:46.400 --> 08:49.040
a command through a
list of commands.

08:49.040 --> 08:52.220
Pretty much you start typing
the command as you can see

08:52.220 --> 08:53.820
here on the right and they'll

08:53.820 --> 08:55.890
give you a nice little list.

08:55.890 --> 08:57.800
This is nice because
if you can't

08:57.800 --> 09:00.230
remember exactly
what a command is,

09:00.230 --> 09:01.760
you can actually type

09:01.760 --> 09:05.060
different words in the
command and will find it.

09:05.060 --> 09:07.790
Instead of just
IntelliSense that finds

09:07.790 --> 09:10.220
it based on what
you've started typing,

09:10.220 --> 09:13.460
if you were to type just a
word, for example, here,

09:13.460 --> 09:15.005
if you were to type alias,

09:15.005 --> 09:16.115
you would get a list of

09:16.115 --> 09:18.605
all the commands that
had the word alias in it

09:18.605 --> 09:20.660
instead of IntelliSense
where you just

09:20.660 --> 09:23.360
did get-a and it
found it that way.

09:23.360 --> 09:25.325
It's very useful.

09:25.325 --> 09:27.830
Allows you to do keyword
searches and things

09:27.830 --> 09:30.490
like that so you can find
commands little bit easier.

09:30.490 --> 09:32.680
If you want to use it in ISE,

09:32.680 --> 09:35.210
you go to View and
show command add on,

09:35.210 --> 09:36.575
and it shows up on the right.

09:36.575 --> 09:38.080
It's very useful.

09:38.080 --> 09:40.965
Additional help with PowerShell.

09:40.965 --> 09:43.340
You do have about files that

09:43.340 --> 09:45.745
you can access in PowerShell.

09:45.745 --> 09:47.280
There's also a couple of

09:47.280 --> 09:50.395
parameters ShowWindow
and ShowCommand.

09:50.395 --> 09:52.535
Give you some more information

09:52.535 --> 09:54.575
about what you're working with.

09:54.575 --> 09:56.825
The Microsoft Docs website is

09:56.825 --> 09:59.405
super useful for
getting help as well.

09:59.405 --> 10:05.490
That's
https://docs.microsoft.com/en-us/powershell.

10:09.200 --> 10:10.510
Again,

10:10.510 --> 10:12.289
if you're in another country,

10:12.289 --> 10:13.925
go to your Countries

10:13.925 --> 10:16.445
Landing page for
Microsoft documents,

10:16.445 --> 10:19.550
which is usually just
docs.Microsoft.com.

10:19.550 --> 10:22.280
Then type in PowerShell
and it should bring you

10:22.280 --> 10:25.480
directly to the PowerShell page.

10:25.480 --> 10:28.215
It's post assessment time.

10:28.215 --> 10:32.880
If you wanted to get help
for the Get-ADGroup command,

10:32.880 --> 10:35.340
what command would you use?

10:35.340 --> 10:40.560
Would you use help
Get-ADGroup, man Get-ADGroup,

10:40.560 --> 10:44.250
or Get-Help, Get-ADGroup,

10:44.250 --> 10:46.815
or would it be all
of those above?

10:46.815 --> 10:49.580
You can go ahead and
pause for a second.

10:49.580 --> 10:52.315
Then once you're ready,
we'll get the answer.

10:52.315 --> 10:56.820
The answer is actually
all of the above.

10:56.820 --> 10:59.060
Help man and Get-Help are all

10:59.060 --> 11:00.560
valid commands you
can use to get

11:00.560 --> 11:03.150
information about a command.

11:03.260 --> 11:05.660
In this video, we talked

11:05.660 --> 11:08.999
a little bit about how to
get help for PowerShell.

