How to Install PowerShell on Debian 11 or 10

PowerShell, a versatile scripting language and command-line shell, is an essential tool for system administrators and power users. This guide will demonstrate how to install PowerShell on Debian 11 or 10, expanding your system’s capability with its robust features. PowerShell’s adaptability allows for automation of tasks, enhancing productivity and streamlining workflows.

Key Features of PowerShell:

  • Object-Oriented Nature: Handles data as objects, offering flexibility in scripting.
  • Extensive Scripting Language: Enables complex automation scripts, making it highly beneficial for repetitive tasks.
  • Access to COM and WMI: Allows for managing Windows systems with ease.
  • Pipeline Support: Efficient data processing by piping objects from one command to another.
  • Remote Management: Facilitates the management of a network of computers from a single point.

Transitioning seamlessly into the installation process, let’s delve into how you can leverage these features by installing PowerShell on your Debian system. The steps outlined are straightforward, ensuring a smooth setup for harnessing PowerShell’s full potential on your Debian machine.

As of now, there is no official Debian 12 Bookworm build for PowerShell. Using the Debian Bullseye repository on Debian 12, as suggested by some guides, is not recommended for production environments. This guide will be updated when an official build becomes available.

Import PowerShell APT Repository on Debian 11 or 10

Update Debian Before PowerShell Installation

Begin by updating your Debian system to ensure all existing packages are up to date. This step is essential for system stability and compatibility with new installations. Execute the following command:

sudo apt update && sudo apt upgrade

This command refreshes your package list and upgrades the packages, ensuring your system is current.

Install Initially Required Packages

Prior to installing PowerShell, your system requires certain dependencies. These packages facilitate secure communication and management of additional repositories. Install them using the command:

sudo apt install dirmngr software-properties-common apt-transport-https curl lsb-release ca-certificates -y

This command installs necessary packages like dirmngr for managing keys, curl for data transfer, and lsb-release for identifying your Debian version, among others.

Import PowerShell GPG Key and APT Repository

Import the GPG Key

The first step in setting up PowerShell is to import its GPG key. This key verifies the authenticity of packages you’ll be installing. Use the following command:

curl -fSsL  | gpg --dearmor \
     | sudo tee /usr/share/keyrings/powershell.gpg >/dev/null

This command retrieves the key using curl, processes it with gpg --dearmor, and then safely stores it on your system.

Import the PowerShell APT Repository

Next, add the PowerShell repository. This repository is where your system will fetch PowerShell packages. Execute the command below:

echo "deb [arch=amd64,armhf,arm64 signed-by=/usr/share/keyrings/powershell.gpg] \$(lsb_release -sr)/prod $(lsb_release -sc) main" \
    | sudo tee /etc/apt/sources.list.d/powershell.list

This command constructs and adds the correct repository to your system’s sources list, tailored to your specific Debian version, using lsb_release to dynamically insert the version number and codename.

Install PowerShell on Debian 11 or 10

Update Package Lists

After adding the PowerShell repository to your Debian system, it’s important to refresh your package lists. This ensures your system recognizes the newly added repository. Run the following command in your terminal:

sudo apt update

This command updates the list of packages and versions available in all your repositories, including the newly added PowerShell repository.

Install PowerShell via APT Command on Debian

With the repositories updated, you’re now ready to install PowerShell. Execute the following command to begin the installation:

sudo apt install powershell

This command instructs the system’s package manager to download and install PowerShell. It automatically resolves and installs any dependencies required for PowerShell to run effectively on your Debian system.

Activate PowerShell on Debian 11 or 10

After successfully installing PowerShell on your Debian system, the next step is to activate it. Activation is straightforward and involves a single command. Open your terminal and execute:


This command initiates PowerShell, switching from the default shell to PowerShell. You’ll notice the prompt change, indicating that PowerShell is now the active shell environment. Here, you can run PowerShell-specific commands and scripts, harnessing its advanced features for system management and automation.

PowerShell Command Examples on Debian 11 or 10

Basic Commands in PowerShell

Once you’ve accessed PowerShell in your terminal, familiarize yourself with some fundamental commands. These commands form the core of PowerShell’s functionality, helping you navigate and manage your system efficiently.

Displaying Help

To access help documents and learn about PowerShell commands, use:


This command is vital for beginners, providing guidance and detailed information about PowerShell commands.

Viewing PowerShell Information

To see detailed information about your PowerShell environment, execute:


This command displays the version and other relevant details of your PowerShell instance.

Listing Directory Contents

To list the contents of a directory, similar to ls in Unix/Linux, use:


It shows files and subdirectories in the current directory, aiding in file system navigation.

Retrieving Command History

To view your previously executed commands in PowerShell, run:


This command helps in tracking the command history, allowing you to revisit or repeat past commands.

Listing Process Information

To get information about running processes, similar to the ps command, use:


This command is useful for monitoring and managing system processes.

Finding Command Aliases

To discover aliases for PowerShell commands, use:


This command helps in identifying shorthand versions of commands, enhancing efficiency.

Checking System Services

To list system services and their statuses, execute:


This command is essential for system administration tasks, like monitoring service statuses.

Fetching System Event Logs

To view system event logs, use:

Get-EventLog -LogName System

This command is crucial for system diagnostics and understanding system events.

Managing Network Information

To display network configuration, similar to ipconfig in Windows, run:


This command aids in network troubleshooting and configuration reviews.

Viewing Active Network Connections

To see active network connections, execute:


Useful for monitoring network activity, this command helps in identifying active connections and their states.

Exiting PowerShell

To exit the PowerShell session, simply type:


This command returns you to your default shell.

Managing PowerShell on Debian 11 or 10

Update PowerShell on Debian

Regular updates are crucial for maintaining PowerShell’s functionality and security. To update PowerShell, along with all other APT packages on your Debian system, use this command:

sudo apt update && sudo apt upgrade

This command first updates the list of available packages and then upgrades them to their latest versions. It’s a comprehensive way to ensure your system, including PowerShell, stays up-to-date.

Remove (Uninstall) PowerShell from Debian

If you decide that PowerShell is no longer needed on your system, uninstalling it is straightforward. Execute the following command:

sudo apt remove powershell

This command removes the PowerShell package from your system while leaving other packages unaffected.

After uninstalling PowerShell, it’s good practice to remove its repository from your system. Use this command:

sudo rm /etc/apt/sources.list.d/powershell.list

Removing the repository ensures that your system’s package manager will no longer check for updates for PowerShell.

For security and cleanliness, it’s advisable to also remove the PowerShell GPG key with:

sudo rm /usr/share/keyrings/powershell.gpg


In this guide, we’ve journeyed through the complete process of installing, using, and managing PowerShell on Debian 11 or 10. From updating your system, installing required packages, to leveraging PowerShell’s powerful command-line features, we covered the essentials to get you started. Remember, regular updates are key to maintaining PowerShell’s efficiency and security. Should you ever decide to part ways with PowerShell, we’ve also guided you through a clean and secure uninstallation process. As you continue to explore PowerShell, keep experimenting with its diverse commands to fully harness its capabilities for

Your Mastodon Instance
Share to...