The first term I need to define is cmdlet.
This is the basic PowerShell command.
Think of the name as meaning little command, cmdlet.
Cmdlets are written in a .NET language and compiled.
Now,
those details don't really matter to you other than realizing
that these are essentially binary commands,
so you can't see the source code.
The most important aspect of a cmdlet is that it does one thing and
writes one type of object to the PowerShell pipeline.
Now,
this is very similar to the Linux model where command line
programs like grep and sed only do one thing,
and then you join them together to make a single command statement.
Now we don't have monolithic commands in PowerShell.
We have commands that do specific things like get a service or stop a
process or create a new Active Directory user account.
A function isn't that much different than a cmdlet.
In fact, it behaves just like a cmdlet.
You, when you use it, really can't tell the difference.
But one big difference is that functions are almost always
written in PowerShell scripting language.
This means you can look at the source code.
Now you typically wouldn't change it,
but because functions are typically a type of PowerShell script,
you will eventually learn how to write your own.
And functions, like cmdlets,
are designed to do one thing and write one type of object to the pipeline.
Yes, there are always exceptions,
but that should be the model that you will follow.
You'll also encounter the term script in PowerShell.
Now scripting is the journal process of creating these types of commands.
A PowerShell script is a text file with a PS1 file extension.
The commands in the file are executed sequentially,
just as if you had typed them manually at a PowerShell prompt.
You can think of a PowerShell script as a fancy type of batch file.
We use PowerShell scripts to define our functions,
but more often we use scripts to run cmdlets and functions in
some sort of structured or planned order.
A good way to think of PowerShell scripts is as a controller or orchestrator.
You can use a PowerShell script to automate tasks and steps.
I often think of them as canned or recorded PowerShell sessions,
so instead of interactively running a series of commands,
I can put them in a PS1 file and execute the script.
PowerShell scripts have a bit more flexibility and can do more than one thing,
but you don't want to get too monolithic.
There's plenty of PowerShell scripting content in the Pluralsight catalog.
Technically, there is one more type of PowerShell command,
and that is an alias. Although in reality an aliases just an
alternate name for a PowerShell command,
such as a cmdlet, function or script,
they're often shorter and sometimes easier to use.
So instead of typing the command Get‑Process,
you could type a shorter alias like ps. In fact,
one of the reasons we had aliases were to provide
transitions from other shells and platforms.
If you need to list files in a folder by don't know
the actual PowerShell command yet, which,
by the way, is Get‑ChildItem, you can use an alias like dir or ls.
Although be aware that on Linux systems,
many of the PowerShell aliases have been removed to avoid
conflicting with the real native commands like ls or ps.
The last definition I have for you is parameter.
Now you'll hear this term a lot in PowerShell. This is something
that applies to cmdlets, functions, and scripts.
A parameter provides a way to customize the behavior of the command,
such as specifying a certain path or group of services.
Command line tools have always had parameters,
sometimes they are referred to as switches.
But don't hold on to that term as switch. In PowerShell,
it means something entirely different, which you'll eventually learn.
The important thing for you to know right now is that
some parameters are positional,
meaning you only have to type the value like the name of a service.
Otherwise,
all parameters in PowerShell follow a standard convention of a dash,
then the parameter name, a space, and then the value.
If you need to pass multiple values, like a group of computer names,
those are separated by commas. As you work with PowerShell,
you'll also see the parameter names are also kind of standardized.
If you need to specify the parameter and pass the name of a computer,
it's almost always going to be computer name.
These standards make PowerShell commands easy to learn and use because you don't have to guess at they syntax.