How to Install PowerShell Core: A Quick Guide

Discover the easy way to install PowerShell Core and unleash powerful scripting capabilities. Follow our step-by-step guide for a smooth setup.
How to Install PowerShell Core: A Quick Guide

To install PowerShell Core, simply download the installer from the official Microsoft repository and execute it, or use the command below for a quick installation via a package manager.

# For Windows using the command line
winget install --id Microsoft.Powershell --source winget

# For macOS using Homebrew
brew install --cask powershell

# For Linux (Debian-based) using APT
sudo apt-get install -y powershell

What is PowerShell Core?

Definition

PowerShell Core is a cross-platform version of PowerShell built on .NET Core, allowing it to run not just on Windows but also on macOS and various Linux distributions. It is significantly different from Windows PowerShell, which was exclusively designed for the Windows operating system. This modern iteration is more versatile and suitable for a broader range of scripting and automation tasks.

Key Features

PowerShell Core brings a suite of features that lend it an edge in automation and management:

  • Cross-platform compatibility: PowerShell Core can be utilized across multiple operating systems, making it an excellent choice for users who work in diverse environments.
  • Open-source nature: Being open source, PowerShell Core is continuously improved by a community of developers, ensuring it remains cutting-edge and effective.
  • Modern, extensible design: Its design allows users to extend functionalities easily, integrating new modules that enhance its capabilities.
  • Built-in support for REST APIs and JSON: PowerShell Core facilitates the manipulation of RESTful APIs and JSON data structures seamlessly.
Mastering the Art of Install PowerShell Modules
Mastering the Art of Install PowerShell Modules

Prerequisites for Installation

System Requirements

Before installing PowerShell Core, ensure that your system meets the following requirements:

  • Supported operating systems: PowerShell Core can be installed on Windows, macOS, and various distributions of Linux such as Ubuntu and CentOS.
  • Hardware specifications: While specific hardware requirements may differ between operating systems, having a modern system with at least 4GB of RAM is advisable.
  • Necessary permissions for installation: Administrative rights are required to install PowerShell Core, especially on Windows-based systems.

Tools and Resources

Familiarize yourself with tools that will facilitate the installation:

  • Windows Package Manager: A convenient method to install software on Windows.
  • Mac Homebrew: A popular package manager for macOS.
  • Linux package managers like `apt`, `yum`, or `dnf`, depending on your Linux distribution.
Uninstall PowerShell Module: A Simple Step-by-Step Guide
Uninstall PowerShell Module: A Simple Step-by-Step Guide

Installation Steps for PowerShell Core

Installing on Windows

Using Windows Installer

To install PowerShell Core using the Windows Installer:

  1. Download the latest release from the official PowerShell GitHub repository.
  2. Once downloaded, execute the installer by running:
Start-Process msiexec.exe -ArgumentList '/i PowerShell-<version>-win-x64.msi /quiet'

This command runs the installer silently, meaning it won't prompt you for input during the installation process.

Using Windows Package Manager

If you prefer a quicker approach, you can use the Windows Package Manager. Open PowerShell with administrative privileges and execute the following command:

winget install Microsoft.PowerShell

This command will automatically download and install the latest version of PowerShell Core.

Installing on macOS

Using Homebrew

If you are using macOS, the easiest way to install PowerShell Core is through Homebrew. First, ensure you have Homebrew installed, then run:

brew install --cask powershell

This command installs PowerShell Core, and you can start it by typing `pwsh` in your terminal.

Using Direct Download

Alternatively, you can download the .pkg file directly from the PowerShell GitHub releases page. After downloading, simply double-click the .pkg file and follow the installation instructions.

Installing on Linux

For Ubuntu/Debian

To install PowerShell Core on Ubuntu or Debian, follow these steps:

  1. Configure the Microsoft repository and install GPG keys:
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
  1. Next, add the PowerShell repository to your list of sources:
echo "deb [arch=amd64] https://packages.microsoft.com/repos/ubuntu/ focal main" | sudo tee /etc/apt/sources.list.d/microsoft.list
  1. Finally, update the package list and install PowerShell:
sudo apt-get update
sudo apt-get install -y powershell

For CentOS/Fedora

For CentOS or Fedora users, you can install PowerShell Core with the following commands:

sudo dnf install https://packages.microsoft.com/config/rhel/7/prod.repo
sudo dnf install powershell
Install PowerCLI PowerShell: A Quick Start Guide
Install PowerCLI PowerShell: A Quick Start Guide

Verifying the Installation

Launching PowerShell Core

To verify that PowerShell Core has been successfully installed, open your command line interface and type:

pwsh

This command may vary based on your operating system, but `pwsh` is the command to enter PowerShell Core.

Confirming the Installation

You should check the version of PowerShell Core to ensure it's installed correctly. Run:

$PSVersionTable.PSVersion

This will display the current version of PowerShell running on your machine. If you see a version number you expect, you've successfully installed PowerShell Core!

Understanding Microsoft.PowerShell.Commands.Internal.Format.FormatStartData
Understanding Microsoft.PowerShell.Commands.Internal.Format.FormatStartData

Common Issues and Troubleshooting

Installation Errors

While installing PowerShell Core, you might encounter some common errors. If the installation fails, check the installation logs, which can provide specific error messages that point to the problem. Ensure your system meets all prerequisites and that you have administrative rights.

Compatibility Issues

If you are attempting to run PowerShell Core on an older or unsupported operating system, you may run into compatibility issues. In such cases, validate that all dependencies are met and that you are using the correct package manager commands for your system.

Invoke-PowerShell: Mastering Command Execution Effortlessly
Invoke-PowerShell: Mastering Command Execution Effortlessly

Upgrading PowerShell Core

Importance of Keeping Up to Date

Regularly upgrading PowerShell Core is crucial for taking advantage of new features, improvements, and security patches. Each new version comes with enhancements that can significantly streamline your automation tasks.

Upgrade Commands for Different Platforms

To upgrade PowerShell Core, execute the appropriate commands based on your operating system.

  • Windows: Use the Windows Package Manager:
winget upgrade Microsoft.PowerShell
  • macOS: Upgrade using Homebrew:
brew upgrade --cask powershell
  • Linux: Use the respective package manager commands to upgrade:

For Ubuntu/Debian:

sudo apt-get update
sudo apt-get install --only-upgrade powershell

For CentOS/Fedora:

sudo dnf upgrade powershell
Brew Install PowerShell: A Quick Start Guide
Brew Install PowerShell: A Quick Start Guide

Conclusion

PowerShell Core offers a powerful scripting environment that is beneficial for both beginners and advanced users in automating tasks across different platforms. By following this comprehensive guide to install PowerShell Core, you are now equipped to leverage its capabilities effectively. Dive into scripting and automation, and consider joining our community for more insightful guides and resources on mastering PowerShell.

Function PowerShell Return: A Quick Guide to Outputs
Function PowerShell Return: A Quick Guide to Outputs

Additional Resources

For those looking to further explore PowerShell Core, refer to the official PowerShell documentation, community forums, and various online tutorials to enhance your learning experience.

Related posts

featured
2024-11-16T06:00:00

Mastering Citrix PowerShell Commands with Ease

featured
2024-04-22T05:00:00

Restart PowerShell: A Quick How-To Guide

featured
2024-07-25T05:00:00

WinSCP PowerShell Made Easy: A Quick Guide

featured
2024-04-26T05:00:00

OpenSSL PowerShell: Unlocking Encryption with Ease

featured
2024-05-14T05:00:00

Stop PowerShell Script: A Simple Guide to Terminate Safely

featured
2024-05-16T05:00:00

Adsync PowerShell Commands: A Quick Guide

featured
2024-11-17T06:00:00

Mastering Emacs PowerShell Mode for Efficient Scripting

featured
2024-03-28T05:00:00

Mastering Credentials in PowerShell: A Quick Guide

Never Miss A Post! 🎉
Sign up for free and be the first to get notified about updates.
  • 01Get membership discounts
  • 02Be the first to know about new guides and scripts
subsc