💾 Archived View for pwshnotes.flounder.online › gemlog › 2021-08-16-installing-powershell.gmi captured on 2021-12-04 at 18:04:22. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-12-03)

-=-=-=-=-=-=-

Installing PowerShell

Background

There are two basic types of PowerShell.

PowerShell 5.1 is installed with Windows 10 and is therefore available in every Windows 10 installation. It is known as "Windows PowerShell". And the executable is "powershell.exe". That means powershell.exe will always launch PowerShell 5.1.

PowerShell 7 (currently 7.1.4) is available to download from Microsoft. It is open source and cross-platform. PowerShell 7 can be installed on Windows, macOS, and Linux. PowerShell 7 is known as simply "PowerShell": having taken that name from the earlier Windows-only versions. The former name of v6 and v7 was "PowerShell Core". The name PowerShell Core is still sometimes used to differentiate these versions of PowerShell from the Windows-only versions. The executable for PowerShell is "pwsh.exe". This means that Windows PowerShell 5.1 (powershell.exe) and PowerShell 7 (pwsh.exe) can be installed side by side and used without interfering with each other. They also have separate configuration files which facilitates this. pwsh.exe will always launch some version of PowerShell Core depending on which version was installed by you or your organization. This might include PowerShell 6 which was the first open source version.

You can check which version of PowerShell you are using by invoking the version variable, $PSVersionTable, which produces the following output. The version can be seen on the "PSVersion" line.

# PowerShell 7
$PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.1.4
PSEdition                      Core
GitCommitId                    7.1.4
OS                             Microsoft Windows 10.0.19043
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0


# PowerShell 5.1
$PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.19041.1151
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1151
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

I will focus on installing PowerShell 7 in a new installation of Windows 10. If you want to see what other installation options there are or to install PowerShell on a different platform, please see the link at the bottom.

On Windows, it is possible to install PowerShell from either the Microsoft Store or from a downloaded file. Each method has advantages. The limitations of the Store install can be seen at the link at the bottom.

Advantages to Microsoft Store

Advantages to Download

I won't assume a Microsoft account. So I will download a package from GitHub and install that. However, this does require local administrator privileges.

Installing PowerShell

Launching PowerShell

After installing PowerShell, you can find a shortcut located in the Start Menu. Remember that "PowerShell" denotes PowerShell 7 and "Windows PowerShell" is version 5 which comes with Windows.

PowerShell will launch in a new console host.

References

Installing PowerShell | Microsoft Docs

Limitations of Installing from the Microsoft Store

PowerShell Latest Release | GitHub

Created: Monday, August 16, 2021

Updated: Monday, August 16, 2021