Introduction to PowerShell

by Barry Dysert
(last updated September 29, 2020)


PowerShell is a built-in Windows utility that includes an extensive scripting language. If you're used to writing .bat files to perform command-line actions, you will be impressed with all that PowerShell can do. Please note that I am not (yet) a PowerShell guru. As I've been working with it, though, it has come to impress me so much that I wanted to introduce the loyal readers of WindowsTips to it.

You can start PowerShell in a few different ways, and it depends on what version of Windows you're running as to what you'll see. Therefore, although I'll mention different ways of invoking it, I'll concentrate on using PowerShell from the command line.

One way to invoke PowerShell is to open a Command Line window (which is covered under another tip), and type "PowerShell" (without the quote marks) followed by Enter. Another way is to use the search capabilities of Windows to search for "Windows PowerShell." A third way is to again search for "Windows PowerShell" and choose the search result called "Windows PowerShell ISE." In the latest version of Windows 10, when you select this item, you'll see a split screen where you can interactively enter PowerShell commands in the left side of the screen and also build a PowerShell script file in the left side of the screen. The Windows PowerShell ISE screen looks like this: (See Figure 1.)

Figure 1. Windows PowerShell ISE.

If you are using an earlier version of Windows 10, when you select this item you'll see a split screen where you can interactively enter PowerShell commands in the bottom of the screen and also build a PowerShell script file in the top of the screen. This split screen may look like this: (See Figure 2.)

Figure 2. PowerShell ISE.

Once you're in PowerShell, you deal mostly with "cmdlets". The cmdlets follow a pattern of verb-noun. For example, to get help within PowerShell, type Get-Help and press Enter. There will be other tips about PowerShell, but if you can't wait, it is suggested that you start by going through the following help topics:

PS> Get-Help Get-Command
PS> Get-Help Get-Member
PS> Get-Help Where-Object
PS> Get-Help About_Object

The first command returns information about cmdlets, while the second gets the properties and methods of an object. The third command filters object properties and the final command explains the use of objects in PowerShell.

A PowerShell script can be a bit on the verbose side, so it incorporates things called aliases, which are shortcuts for many of the more popular cmdlets. For example, instead of typing Get-Help, you can just type Help. To see a list of existing aliases, type Get-Alias at the PS prompt.

PowerShell scripts are normal text files that end with a .ps1 extension and contain a sequence of cmdlets designed to perform a function. For example, you could write a PowerShell script that displays "Hello" to the console. Before you can run scripts, though, you must first establish the security environment. Follow these steps:

Invoke the Windows Command Line, specifying Run As Administrator

Invoke PowerShell by typing "PowerShell" at the command prompt

At the PowerShell prompt type Set-ExecutionPolicy RemoteSigned

These steps only need to be done once for you to be able to henceforth run scripts. Now launch Notepad and type into it the following:

Write-Output "Hello"

Exit Notepad, naming your file Hello.ps1, and be sure it's saved to the directory indicated by your PowerShell session. (The directory name is part of the PowerShell prompt; I have a C:\PowerShell directory where I store all my .ps1 files.) From your PowerShell prompt type ".\Hello.ps1" and you should see your script executed, i.e., the word "Hello" will be displayed on the screen.

There is plenty more that can be said about PowerShell, but since this is an introductory tip, I'll just mention a few more things. Since it's always good practice to comment your scripts you should know that the PowerShell comment character is the "#" symbol. Anything that appears to the right of this character is ignored. And, speaking of special characters, if you need to continue a PowerShell line to another line, end the first line with an accent grave ("`"), sometimes called a backtick character or a backwards apostrophe.

Another thing to get used to is the ability to "pipe" the output of one command to another. PowerShell scripts often have their cmdlets pipe to other cmdlets. The pipe character is the "|" symbol. So, for example, you can format the output of one cmdlet different ways by piping into one of the "format" cmdlets. Let's say you wanted to get the properties of a file named "C:\Temp\VmwareStatus.log". You can do this using the Get-ItemProperty cmdlet like so:

PS> Get-ItemProperty C:\Temp\VmwareStatus.log

By default, the file's properties will be displayed in a table format. If you want the properties displayed in a list, you can pipe the output to the Format-List cmdlet:

PS> Get-ItemProperty C:\Temp\VmwareStatus.log | Format-List

Finally, if you want to return to the familiar command-line environment, just type "cmd" at the PowerShell prompt. To exit this environment, just type "Exit". To exit PowerShell, you also type "Exit".

 This tip (13506) applies to Windows 7, 8, and 10.

Author Bio

Barry Dysert

Barry has been a computer professional for over 35 years, working in different positions such as technical team leader, project manager, and software developer. He is currently a software engineer with an emphasis on developing custom applications under Microsoft Windows. When not working with Windows or writing Tips, Barry is an amateur writer. His first non-fiction book is titled "A Chronological Commentary of Revelation." ...


Starting Windows 10 in Safe Mode

Hopefully you'll never find yourself in a situation where you need to restart your computer in Safe Mode. If you do, ...

Discover More

Creating a System Restore Point

System restore points are created automatically at strategic times in the operation of your computer. You can also ...

Discover More

Determining if You Have 32-bit or 64-bit Windows

There are occasions when you may want to know whether you're running the 32-bit or 64-bit version of Windows. This tip ...

Discover More
More WindowsTips

PowerShell Input and Output

When dealing with a scripting language like PowerShell, one of the first things you need to learn is how to get data into ...

Discover More

Creating a Simple Batch File

One of the powerful capabilities built into Windows is the ability to create and use batch files to perform a wide ...

Discover More

Using Batch Files, Part 3: The IF Command

This tip is part of a series that talks about Windows batch files. It introduces a few more commands you can use in your ...

Discover More

FREE SERVICE: Get tips like this every week in WindowsTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.


If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 1 + 7?

2017-01-19 16:02:01

Ray Ross

Thanks for this tip. I look forward to more Power Shell tips.

2016-12-28 16:35:15

Ted Duke

Thanks. The text has some missing and required quote marks as in type:

Set-ExecutionPolicy RemoteSigned

which worked Ok after I typed

"Set-ExecutionPolicy RemoteSigned"

2016-12-28 15:37:02

Steve Harrison

To Barry.
Thanks for replying, I will persevere.

2016-12-27 17:14:43


There is no one place that I know of. Your best bet is probably to use the Help utility and do a lot of searching of the Web. Good luck.

2016-12-27 15:36:20

Steve Harrison

Thank you for a very good article. I, also, am trying to learn Powershell but am frustrated by a lack of very basic instructional information. Does anyone have any knowledge of a site providing such info. There are plenty of sites that assume a much greater starting knowledge than I have.

Newest Tips

FREE SERVICE: Get tips like this every week in WindowsTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.