Getting Started with PowerShell 7
(Installation, Updating & More)
What We'll Learn:
In this short guide we’re going to learn how to get started with PowerShell 7.
- We’ll start by learning what exactly PowerShell is.
- We will then learn how to launch it.
- And finally, we’re going to check which version we have and if necessary, how to upgrade it.
Let’s get started!
What is PowerShell?
PowerShell is a task-based command-line shell and scripting language developed by Microsoft and built on the .NET framework. It can be used for everything from system administration and task automation to managing operating systems and applications.
It can not only be used to manage Windows, but also other operating systems such as Linux or Mac.
PowerShell provides access to, including but not limited to:
- Traditional command line tools
- The .NET framework
- Windows Management Instrumentation
- Common Information Model
- And more.
An important recent change is that PowerShell is now open source and its base source code is available on GitHub, which is great news for everybody!
Here are some of its key features:
- The remoting feature allows you to easily run PowerShell cmdlets and scripts on remote machines with a diverse set of operating systems such as Windows, Linux, or Mac OS.
- With PowerShell various background jobs and tasks can easily be scheduled.
- Just like any other programming language, it supports error handling through the Try, Catch, and Finally statements.
- Learning PowerShell becomes easy with the built in Get-Command, Get-Help, and Get-Member cmdlets which will help you discover new cmdlets.
- Its supports autocompletion for cmdlets, parameters, and properties using the Tab key, which will make your life easier.
If you are not familiar with some of the terminology I used to describe the plethora of options and features it has, consider enrolling in our beginners course where we will teach you the ins and outs of PowerShell.
How To Open PowerShell
Now that we have a general idea of what it is, let’s start using it.
To launch/open your console, simply type “PowerShell” in your windows search field and select the first option that appears. It should be named “Windows PowerShell”.
The console will open at once.
In many cases you might be required to launch PowerShell as an administrator, to do so search for “PowerShell” in your windows search field, just like before, but instead of clicking directly on the first result, right click it instead and select ‘Run as administrator’ from the window that appears.
Be careful when using a console with elevated privileges, the wrong operation can very easily break your computer.
How To Check Your PowerShell Version.
It is always a clever idea to use the latest version, so that you can take advantage of the latest usability and security features.
To easily check which version you currently have, type a dollar sign into your console directly followed by the word psversiontable.psversion and press enter.
Under “major” your PowerShell version should appear. Currently the latest version is 7. If you don’t have the latest version, let’s go over on how you can have it installed.
Updating to PowerShell Version 7
Upgrading your installation is easy, simply follow the steps listed below:
- Go over to the official GitHub page by clicking here, and select the version you want to install. It is recommended that you avoid preview releases, so scroll down until you find a non-preview option and click on it.
- Next, you need to select and download the MSI file for your OS and architecture. For most of you, the appropriate version will be as follows (Windows): PowerShell-7.0.0-win-x64.msi.
- Once you find the appropriate version, simply click on it to begin your download.
- Once the download is finished open your file and simply follow the instructions on the wizard to install it. Please note that PowerShell 7 will coexist with your current installation.
Congratulations! You just updated your installation to the latest version. Lets start using it!
If you already have a window of an older version of PowerShell open, use the “pwsh” command to switch to the latest version.
Note, that for some versions, this command will not work, if that’s the case for you, launch the latest version by searching for “PowerShell 7” in your search field and selecting the first result.
The latest version should open at once. If you would like to, check your version once again, from the upgraded installation, by checking the value of the $PSVersionTable.PSVersion variable.
Under major the number 7 should appear.
Taking a look around PowerShell 7
Now that we are ready, lets take a look around the console.
The first two lines display basic information about our windows version. Feel free to ignore these.
In the next line you will see the location or path at which the console is located now, and it’s called the current working directory. The word directory in this context is interchangeable with folder.
What Exactly Is a Path?
In windows, files and folders are organized using paths.
A file path is an alternative name for the location of a file. For example, we can view the path or location of a file by right clicking on it, going over to its properties and finding its path in the in the “location” field.
Within the console the only way for us to navigate through the file system is by using file paths.
By default, the console is located in a folder named after your computers username within your user’s directory.
Such as: C:\Users\Julian.
So, this in a way, would be the equivalent of navigating to the C:\Users\Julian directory from the windows file manager.
You should now have a general idea of what PowerShell is and are ready to start using it.
- PowerShell is an extremely powerful tool and it hosts a myriad of useful features and tools.
- Launching it is quite easy, simply search for PowerShell 7 and select the first result, just like we learned.
- If you are not using the latest version, make sure you check and upgrade your installation.
You now know how to begin working with PowerShell and are ready to start working with it.
If you liked this short guide take a look at a few of our other posts related to PowerShell.
If you really liked it consider enrolling in our begginers course where you will learn the ins and outs of PowerShell.