Installation de PowerShell
Depuis la version 6.0, PowerShell a atteint une prise en charge complète open source et multiplateforme (PowerShell Core / PowerShell 7+), et peut s'exécuter sur Windows, Linux et macOS.
1. Installation de PowerShell 7+ sur Windows
Méthode 1 : Utiliser le programme d'installation MSI (Recommandé)
- Ouvrez la page officielle des versions GitHub de PowerShell :
👉 https://github.com/PowerShell/PowerShell/releases - Trouvez la dernière version et téléchargez celle pour Windows
.msipaquet d'installation - Double-cliquez pour installer ; utilisez simplement le chemin par défaut.
- Une fois l'installation terminée, recherchez"PowerShell 7"et ouvrez-le (il n'écrasera pas Windows PowerShell).
Méthode 2 : Utiliser la ligne de commande (Winget)
Applicable à Windows 10/11 avec Windows Package Manager installé :
winget install --id Microsoft.Powershell --source winget
Paramètres optionnels :--silentindique une installation silencieuse,--version 7.4.1permet de spécifier une version.
2. Installation de PowerShell sur Linux
Ubuntu / Debian
# 安装依赖 sudo apt update sudo apt install -y wget apt-transport-https software-properties-common # 导入微软 GPG 密钥 wget -q https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb sudo dpkg -i packages-microsoft-prod.deb # 安装 PowerShell sudo apt update sudo apt install -y powershell
Démarrer PowerShell :
pwsh
CentOS / RHEL / Fedora
# 添加 Microsoft YUM 源 sudo dnf install -y https://packages.microsoft.com/config/rhel/8/packages-microsoft-prod.rpm # 安装 PowerShell sudo dnf install -y powershell
ou pour CentOS 7, utilisezyum:
sudo yum install -y powershell
Arch Linux / Manjaro
sudo pacman -S powershell
Si vous ne le trouvez pas, vous pouvez utiliser le gestionnaire de paquets AUR (tel que
yay)
3. Installation de PowerShell sur macOS
Méthode 1 : Utiliser Homebrew (recommandé)
brew install --cask powershell
Démarrer PowerShell :
pwsh
Méthode 2 : Téléchargement manuel de l'installateur PKG
- Accédez à la page GitHub Releases
👉 https://github.com/PowerShell/PowerShell/releases - Téléchargement
.pkgle fichier d'installation (tel quepowershell-7.4.1-osx-x64.pkg) - Double-cliquez pour installer et suivez les instructions pour terminer.
4. Vérification de l'installation et désinstallation
Vérifier si l'installation a réussi
pwsh --version
Désinstaller PowerShell
| Plateforme | Méthode de désinstallation |
|---|---|
| Windows | Panneau de configuration → Programmes et fonctionnalités → Désinstaller PowerShell 7 |
| Ubuntu | sudo apt remove powershell |
| CentOS | sudo yum remove powershell |
| macOS(brew) | brew uninstall powershell |
Commandes de démarrage sur différentes plateformes
| Plateforme | Commande |
|---|---|
| Windows | pwsh.exeou recherchez "PowerShell 7" dans le menu Démarrer |
| Linux | pwsh |
| macOS | pwsh |