Training
Module
Introduction to PowerShell - Training
This module introduces PowerShell, a cross-platform command-line shell and scripting language built for task automation and configuration management.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
All packages are available on our GitHub releases page. Before installing, check the list of
Supported versions below. After the package is installed, run pwsh
from a terminal. Run
pwsh-lts
if you installed a preview release.
Note
PowerShell 7.4 is an in-place upgrade that removes previous versions of PowerShell 7. Preview versions of PowerShell can be installed side-by-side with other versions of PowerShell. If you need to run PowerShell 7.4 side-by-side with a previous version, reinstall the previous version using the binary archive method.
Debian uses APT (Advanced Package Tool) as a package manager.
Microsoft builds and supports a variety of software products for Linux systems and makes them available via Linux packaging clients (apt, dnf, yum, etc). These Linux software packages are hosted on the Linux package repository for Microsoft products, https://packages.microsoft.com, also known as PMC.
Installing PowerShell from PMC is the preferred method of installation.
Note
This script only works for supported versions of Debian.
###################################
# Prerequisites
# Update the list of packages
sudo apt-get update
# Install pre-requisite packages.
sudo apt-get install -y wget
# Get the version of Debian
source /etc/os-release
# Download the Microsoft repository GPG keys
wget -q https://packages.microsoft.com/config/debian/$VERSION_ID/packages-microsoft-prod.deb
# Register the Microsoft repository GPG keys
sudo dpkg -i packages-microsoft-prod.deb
# Delete the Microsoft repository GPG keys file
rm packages-microsoft-prod.deb
# Update the list of packages after we added packages.microsoft.com
sudo apt-get update
###################################
# Install PowerShell
sudo apt-get install -y powershell
# Start PowerShell
pwsh
PowerShell 7.2 introduced a universal package that makes installation easier. Download the universal package from the releases page onto your Debian machine.
The link to the current version is:
https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/powershell_7.4.6-1.deb_amd64.deb
https://github.com/PowerShell/PowerShell/releases/download/v7.2.24/powershell_7.2.24-1.deb_amd64.deb
https://github.com/PowerShell/PowerShell/releases/download/v7.5.0-rc.1/powershell-preview_7.5.0-rc.1-1.deb_amd64.deb
The following shell script downloads and installs the current release of PowerShell. You can change the URL to download the version of PowerShell that you want to install.
###################################
# Prerequisites
# Update the list of packages
sudo apt-get update
# Install pre-requisite packages.
sudo apt-get install -y wget
# Download the PowerShell package file
wget https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/powershell_7.4.6-1.deb_amd64.deb
###################################
# Install the PowerShell package
sudo dpkg -i powershell_7.4.6-1.deb_amd64.deb
# Resolve missing dependencies and finish the install (if necessary)
sudo apt-get install -f
# Delete the downloaded package file
rm powershell_7.4.6-1.deb_amd64.deb
# Start PowerShell
pwsh
sudo apt-get remove powershell
$PSHOME
is /opt/microsoft/powershell/7/
$PSHOME/profile.ps1
$PSHOME/Microsoft.PowerShell_profile.ps1
~/.config/powershell/profile.ps1
~/.config/powershell/Microsoft.PowerShell_profile.ps1
~/.local/share/powershell/Modules
/usr/local/share/powershell/Modules
$PSHOME/Modules
~/.local/share/powershell/PSReadLine/ConsoleHost_history.txt
PowerShell respects the XDG Base Directory Specification on Linux.
Microsoft supports PowerShell until PowerShell reaches end-of-support or the version of Debian reaches end-of-life.
Install package files (.deb
) are also available from https://packages.microsoft.com/.
Docker images containing PowerShell 7.4 and PowerShell 7.5-preview for x64 are available from the Microsoft Artifact Registry for the following versions of Debian:
Important
The Docker images are built from official operating system (OS) images provide by the OS distributor. These images may not have the latest security updates. Microsoft recommends that you update the OS packages to the latest version to ensure the latest security updates are applied.
Microsoft supports the installation methods in this document. There may be other methods of installation available from other third-party sources. While those tools and methods may work, Microsoft can't support those methods.
PowerShell feedback
PowerShell is an open source project. Select a link to provide feedback:
Training
Module
Introduction to PowerShell - Training
This module introduces PowerShell, a cross-platform command-line shell and scripting language built for task automation and configuration management.