You need to learn the basics and have a point of reference for build on your own scripts.
And this lesson will cover core power shell concepts that will provide you with a foundation of knowledge
for using their remaining examples.
In this course if you are already familiar with power shell you may want to use this video as a review
or as a reference for later after you've started writing scripts.
If you are completely new to power shell the concept might be familiar.
If you've worked with Unix common shells like Unix based shells or Shell also allows you to stream multiple
commands together on one line using a technique called Pipeline.
This means that the output of one command becomes the input for another.
First off let's open power shall run a search for power shall on your computer.
You probably have several different options like power shall power shall I as a power shell x eighty
six.
The ISC or integrated scripting environment as I have mentioned already is a handy tool which allows
you to write scripts on the fly and also has a conventional low carb for all the power shell commands.
Right now this is more than we need access to six exist for backwards compatibility.
We want X 64 bit for our usage and we'll use the one just called Windows power show.
You may want to be in it to your bar right click it together this option when you open it it will look
like this.
If you don't like the white on blue right click the top bar select properties and go to colors to change
things.
You may have to close and threw open power shell together to display correctly when we are ready.
We can navigate our system and I seen about power shall as you always know where you are because it
tells you that in the prompt.
In my case it's like this but you should see something similar.
Marta is your user name in case you don't just type a cell space field character.
Make sure to include this space.
This will bring you to your home.
Director a director is just another word for folder and power shell considers your user folder to be
your home.
Entering our cell space tilt is just like opening the folder called to users and from there using your
graphical user interface.
So let's start by learning how to move around between directories and view their contents.
To view director accountants you could use get the child item command led.
There are several aliases for it.
Also you could type GC I alas or Dear All those are aliases for the get this child Titan command let
our first command is girl child Titan so go ahead and type it in and hit enter.
You'll see a list of everything in your current director.
In my case that looks like this it could be different on your screen.
Notice that instead of this long command get this child to item you could just enter juicy AI.
It's an abbreviation for it or alias the commands will let command.
So we will be alone in are all of the form verb Dash.
Now these so-called command levels and to their form is supposed to make it easy to remember what they
do and predict similar command levels because command lets a rather long.
Most of them come with slick or aliases.
As I've mentioned that you can use instead.
I will first present.
Come on let's with their names but all this subsequently use the standard aliases because they are much
faster to work with.
It is important to note that many command LEDs have multiple aliases for instance.
These Goodchild type item either GCI dear or less all of them do exactly the same thing.
While it is unsurprising that GCI is short forget child Titan you might be wondering where deer or alas
come from power show is relatively new and its designer as anticipated.
Many people who would use it would already have experience with some existing command line interface
specifically either with Microsoft command line interface called command prompt or as Linux command
line interface like bash which is now also standard on all six last man.
Come on let's have an alias that is standard command in one of these two systems and often for both
in the present example duel comes from command prompt and allows comes from bash I'll use power shell
style aliases in this demonstration but I'll try to mention are the common aliases particular those
familiar for bash users so Linux users so go ahead and try use them GCI dear or allows command and see
the contents of your directory.
Now when we did it we can move between directories with set dash location command left or as L abbreviation
for it or C D command it's good for common to prompt previous command prompt Windows system and Linux
system lets type a cell and some folder which you can see in the output of your previous command and
it'll change your location from your current location to the folder you've specified we can move back
to your previous location again by type in SL and two dots and of course the space between a cell command
and two dots now trial navigate and back to the folder you've been before and to some other folder Mixon
Siddiqa amount and a cell command if you want to navigate to level sloppier good try type in a cell
space two dots backslash two dots instead of backslash you could also type slash so power Shell is not
case insert sensitive and doesn't care about the slashes so it could be a backslash or just slash.
Now we can try create a new directorate with M card dear command in any folder you lie if you want to
get back to your home direct to reforest you could type again a cell space tilt and it'll get you to
your home director and here we can make a new directory Let's type M Kadir and call the directory like
the s or whatever name your line Move into your new director using as our command by type in a cell
and whatever your title to your director in my case it's appears now Let's type GC I and you'll see
that there is nothing here that's because we've just created this directory and it's empty we could
again create a sub directory here with M.K. dear so let's create it type in M.K. dear and give it some
long name in quotes like this is very long name note that if you give some long name to this directory
you should put it in quotes.
Now enter GCI and hit enter again and you'll see your new directory.
Suppose we want to move into this director who would have to type as L and this long name.
Not only will this take a while to tie but if we have got one letter from power shall won't be able
to find our director.
Instead try.
Just type in a cell D and then hit the tab key and power shall complete the name of the director for
you including the quotes you then tap for auto completion will save you a lot of time you'll notice
that when power shell completed the name it also threw in a dot backslash at the beginning of the directory
name the dot is just shorthand for the car and director when you type commands power shall.
All this assumes there is a dot backslash at the beginning.
In other words that you are referring to Sampson in the current director so you don't have to type this
part all the time.
If you want to find some specific command but don't know if this command exists at all you could use
get command command led which is very important and you can try looking for a command with this command
lat so get command itself will output all the commands which are available for you if you need some
command which will be looking for a noun like process you could use get command the noun and specify
the noun you're looking for for example process if you are looking for a command which contains a verb
like start stop etc. You could try years and get command this verb and specify the warp you are looking
for for example start if you're looking for some specific command which is part of some module which
you know like power shall get or active directory module or some other module you could try using get
command module power shall get that will find all the commands in that specific module and of course
you could the standard with specified that you are looking for verb in that module like get commander's
module power shall get and you are looking for a verb find in that module of course you can always look
for help on that command with Get the hell command let and specify the command you need help on for
example find this module get help have has several options like get help us on line get help desk fool
etc. You could try type and get help find this module this fool or dash online or dash.
Examples that will show you only the examples of usage of this command
in addition to get an command led help for commands you can use get help to view supplemental help files
that explain General Power shell concepts that focus primarily on script and to display the help file
for a particular concept type.
Get help about underscore followed by the concept name for example to view the help for the core power
shell commands.
Type the following.
Get help about underscore core underscore commands or to view the entire list of conceptual help files
using the following command.
Get help about underscore asterisk.
Now some words about command aliases throughout this course and the examples used will refer to command
tell us or command letter aliases.
For example the short name of the full command let the aliases can be very handy when trying to type
long scripts where you might want to optimize and keep them as small as and as short as possible.
For instance we have the command left where object.
We have two aliases for it.
You can use question mark for it or just wear it.
Another example is for a rich object.
There are two aliases for riot as well.
You can use % character or just one word for reach.
Another example is select object.
You can use alias just select for release command lat and so on to get a list of all car until this
is just type.
Get Alice.
Now some words about pipelines.
The single most important concept in power Shell is the use of its flexible object based pipeline.
The concept of pipelines is similar.
Is that your sound and the output from one command to another.
But instead of passing plaintext power shell works with objects and we can accomplish some very complex
tasks in just a single line of code.
As a quick example you can get all the services running on the server and pipe it to stop servers command
let with just one line.
You will find all the services and stop them of course.
Don't try to perform this on production server.
Now let's take a look at using a variable sound to objects which you'll be using very often.
The variables are supposed to save temporal data to a new object so you can workers at later for example
to create a variable that stores an instance of the test user mail books.
You can type the following command do your character mailbox equals to get mail box test user.
As you can see to create a variable or instance of an object you prefix the variable name with a dollar
assigned to the right of the variable name.
You have to use the equals assignment operator followed by the value of or the object that should be
assigned to the variable.
Keep in mind that the variables are only available during your current shell session and will be destroyed
when you close the shell.
And remember that you can work with variables in the same room as you work with any object containing
its properties methods and so on.