Working with P2

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
or

Already have an account? Sign In »

Time
1 hour 43 minutes
Difficulty
Intermediate
CEU/CPE
2
Video Transcription
00:00
>> Hello everyone. I'm instructor Gerri Roberts,
00:00
and this is PowerShell scripting.
00:00
In this video, we're going to talk about
00:00
which PowerShell tools you
00:00
can use to work with PowerShell,
00:00
PowerShell and the command line,
00:00
customizing the interface and
00:00
some tools for PowerShell scripting.
00:00
First, let's talk about PowerShell tools.
00:00
In order to use PowerShell,
00:00
you have to use one of the tools.
00:00
There are a couple of main tools that are
00:00
loaded into Windows instances.
00:00
The first one is console.
00:00
There's x64 and x86 version,
00:00
so there's a 32-bit and 64-bit version.
00:00
When opening them,
00:00
x64-bit is usually listed as just PowerShell,
00:00
and x86 is usually listed as PowerShell x86.
00:00
This is good for basic PowerShell usage.
00:00
You also have PowerShell ISE.
00:00
ISE stands for, Integrated Scripting Environment,
00:00
and this is great for writing scripts,
00:00
saving scripts, and testing them.
00:00
To open the tools,
00:00
there are a couple of methods.
00:00
Easiest way of locating and opening them,
00:00
is to use the Windows Search feature
00:00
as you can see picture to the right.
00:00
Typically, when you type in PowerShell,
00:00
you'll get a list that looks similar to this,
00:00
and you'll see that you have
00:00
the ISE x86 and you also have the regular one listed.
00:00
Best practice is to run in administrative mode.
00:00
When you go to open up PowerShell ISE,
00:00
you can either right-click or go administrator mode,
00:00
and that's the same for the consoles.
00:00
Anytime you go and try to open any of
00:00
them, right-click administrative mode,
00:00
or if you noticed in Windows 10,
00:00
you also get this little option here and
00:00
the apps pane that says run as an administrator.
00:00
For server, there's actually
00:00
a special place you can find PowerShell tools.
00:00
If you go to Server Manager and you go to the Tools menu,
00:00
you can find them in there.
00:00
Now you can still search for them just like
00:00
you can in the client version of Windows,
00:00
it just seems a lot quicker to go tools and PowerShell.
00:00
Now, if you're not using
00:00
a tool and you want to use the command line instead,
00:00
you can actually do that.
00:00
It's very simple.
00:00
Opening and closing PowerShell in the command line.
00:00
For opening, you type
00:00
in PowerShell and as you can see here,
00:00
you'll get a prompt that says
00:00
PowerShell copyright information,
00:00
and then you will get
00:00
your listing here with PS in the front,
00:00
instead of just your regular prompt.
00:00
Closing PowerShell, very simple as well,
00:00
just type in exit and you will go back
00:00
to a normal command line prompt.
00:00
The other thing you could do is
00:00
you can customize the interface for PowerShell.
00:00
Now, when you open up PowerShell,
00:00
you'll notice that is very
00:00
basic and the command prompt it's still white on black,
00:00
in PowerShell, it's white on blue.
00:00
You'll want to change that in some cases so
00:00
it's easier for you to read or look at.
00:00
To change it in the command line prompt is simple,
00:00
just right-click the title bar, choose Properties,
00:00
you'll see a little menu comes up and then it pops up to
00:00
this nice little box where
00:00
you can go and change a couple of different things.
00:00
If you go to the font section right here,
00:00
you'll see that you can change font size,
00:00
type, all that good stuff.
00:00
If you want to change the colors so
00:00
it's a little bit easier to read,
00:00
you can go to the colors tab and change those items.
00:00
One thing you'll want to notice in
00:00
the colors tab is that you have
00:00
text for your screen and for pop-ups.
00:00
You can change the background and the text on
00:00
the normal screen as well as
00:00
any pop-ups that might come up as a result of a command.
00:00
In console, very similar to
00:00
the command line prompt on how you're
00:00
going to be able to make those changes,
00:00
just right-click at the top,
00:00
go to properties,
00:00
and you'll see that you get a similar box with fonts,
00:00
colors, and all that good stuff that you can do.
00:00
Again in here, font changes font size, type,
00:00
all that good stuff, and colors
00:00
will change the console colors,
00:00
you have foreground and background
00:00
just as you do in the command line,
00:00
as well as pop-up colors like you do in the command line.
00:00
Now, big difference
00:00
with ISE or Integrated Script Environment,
00:00
there are a lot more options for customization.
00:00
You can do font, color and size.
00:00
If you go to tools and options,
00:00
you can change that in there.
00:00
You'll see it's under colors and fonts.
00:00
There's also some other settings in
00:00
general settings where you can change items,
00:00
like whether or not IntelliSense is turned on,
00:00
whether or not you can view
00:00
line numbers when you're typing it out,
00:00
and all that good stuff.
00:00
Another thing in here that you don't get with others is
00:00
a Restore Defaults where you can go
00:00
back to PowerShell ISE defaults.
00:00
This is something you can't really do in the console.
00:00
You can also change
00:00
how the window is organized and what you want to show.
00:00
On console, on command line,
00:00
you pretty much just have a box and that's it.
00:00
In ISE, you have a couple of
00:00
different boxes with different things
00:00
that you can move around.
00:00
If you want to add things like say,
00:00
the script pane so you can write out your scripts,
00:00
you can go to View and
00:00
then choose the item you want to view.
00:00
Now the script pane can be
00:00
viewed on the right or on the top,
00:00
so that is something to remember so you
00:00
can move that around a little bit
00:00
to make it easier to read.
00:00
You also have a command
00:00
add-on that you can add to the right there.
00:00
It's an add-on that allows you to search for
00:00
commands which is super
00:00
useful if you can't remember a whole command,
00:00
but you remember part of it, you could start
00:00
typing it and all come up with
00:00
a list of similar items to what you're typing.
00:00
Some scripting tools that are available.
00:00
Scripting you can do with PowerShell ISE.
00:00
There are a lot of people that do that,
00:00
and it's very useful, very easy.
00:00
You even have a little options
00:00
for color-coding and stuff like that.
00:00
You can even write your scripts in Notepad
00:00
and just write them out and save them as a.PS1 file.
00:00
You can also use a tool called Notepad++.
00:00
Notepad++ allows you to
00:00
work like you're in a PowerShell ISE,
00:00
your Visual Studio environment where you
00:00
can color-code all your commands.
00:00
You also have Visual Studio,
00:00
you can do PowerShell scripting in Visual Studio and
00:00
save it as a.PS1 and run it as a PowerShell script.
00:00
Our post-assessment time here.
00:00
If you wanted to use
00:00
a PowerShell tool that was good for scripting,
00:00
which tool would you use?
00:00
Would you use the command prompt?
00:00
Would you use PowerShell x86?
00:00
Would you use PowerShell ISE or PowerShell x64?
00:00
Now you can pause, if you'd like.
00:00
The answer is C, PowerShell ISE.
00:00
PowerShell ISE remember is integrated script environment,
00:00
so it's designed for usage with scripts.
Up Next