Installation de powershell sous linux

Creation: 11/10/2023
Mise à jour:
Version: 1.0
Author: Jean-Louis Bicquelet-Salaün
Location: http://jlbicquelet.free.fr
Copyright: (c) 2023 Jean-Louis BICQUELET-SALAÜN

Installation de powershell sous linux

Installation de powershell

Il faut installer les composants systemes.

sudo apt update  && sudo apt install -y curl gnupg apt-transport-https

Il faut ensuite importer les clés du public repository.

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

Il faut enregistrer le Microsoft Product feed.

sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-bullseye-prod bullseye main" > /etc/apt/sources.list.d/microsoft.list'

Installez PowerShell.

sudo apt update && sudo apt install -y powershell

lancement de powershell

Pour lancez powershell sous linux, tapez *pwsh.

Les commandes powershell sont accessibles.

$ pwsh
PowerShell 7.3.6
PS /home/jlb/reinstall> Get-PSDrive

 Name           Used (GB)     Free (GB) Provider      Root
 ----           ---------     --------- --------      ----                      
/                  25,46          1,87 FileSystem    /                         
Alias                                  Alias                                   
Env                                    Environment                             
Function                               Function                                
Temp               25,46          1,87 FileSystem    /tmp/                     
Variable                               Variable                                

PS /home/jlb/reinstall>  write-host $profile
/home/jlb/.config/powershell/Microsoft.PowerShell_profile.ps1