Learning PowerShell – Lesson Three


PowerShell Lesson Three

By: Steven Aiello

Teach Your Self PowerShell – Introduction to PowerShell Commands

PowerShell Prerequisites

Before we get into using PowerShell statements there are some simple prerequisites that I’m going to take you through in order for you to fully understand. If you know what a system service and a system process is, skip this section.

System Service

A system service (in Windows) is generally a program that does not run interactively with the user and does not have a graphical user interface (GUI). An example of a service on Windows would be the Windows Task scheduler. If you look on your Windows system in your services screen (services.msc from the run box) you will see the service called “Task Scheduler”. Now it is true that there is a user interface for Windows Task Scheduler, but in general this is just a process that is running on Windows in the background and does not require human intervention to operate properly.

System Process

In the last paragraph I used a term Windows process. I stated that a service will run in that background as a process. So what is a computer process? In general, a computer process is a piece of code that is currently being executed. This could be a service or any other program. For example, as I’m writing this article, I’m doing research using the Google Chrome browser.

As you can see from the above picture I have several Google Chrome processes running because the web browser launches a new process every time a tab is opened. You can look at all your running processes from the Windows Task Manager.

PowerShell Commands

In general PowerShell follows a very simple syntax:


So for example if we wanted to get some information on something about our system the syntax would be:


If we wanted to configure something on our system the syntax would generally be:


So considering we just learned about system services and processes what do you think we are going to do?


Find PowerShell on your system and enter in the Get-Process command.

The easiest way to do this is by searching for the key word PowerShell from your “Search programs and files” box. Once PowerShell is launched you should see a blue box that looks something like this.

As you can see this command will return a bunch of data about the running processes on your system. If you need to know about the services running on your computer you can execute the command:


What does this command return to you? Did it display the same services you found in your services panel?

For a new PowerShell user the most important command you can know is:


The get help command will give you information about commands you’re trying to use or find. For example you can use the command:

Get-Help *process*

The “*” character acts as a wild card. So the above command will get you command that the system knows with the word process in it. Try the same thing with the search term “user” you should see there are many commands that have to deal with users.

One thing that confuses many people when they start using PowerShell is that their saved scripts will not run. This is because Microsoft has by default set the execution policy of your system to accept scripts that have been digitally assigned by approved authors. While this is good for security it’s not very helpful if we want to write our own scripts, save those scripts, and execute them later. So how would we change this on our system? Let’s do a search in PowerShell for “execution” policy, what option looks good to you? If you said:


You are correct! We want to take the action of setting a policy on the system. In our case we want to set the execution policy of our system so we would use the Set-ExecutionPolicy command. But how do we know what to set the execution policy to? If we use the option “-example” we will see. Try it now:

Get-Help Set-ExecutionPolicy –Examples

As you can see, this will show you almost every possible way to use this command. In our case we want to use the option:

Set-ExecutionPolicy Unrestricted

As you can see, the PowerShell command library is fairly well laid out and logical in its implementation.


Leave a reply

+ eighty five = eighty nine

This site uses Akismet to reduce spam. Learn how your comment data is processed.