Installation de programmes par Powershell
Exemple d'installation par ligne de commande de différentes applications utilisées.
Nuget
Install-PackageProvider -Name NuGet -Scope CurrentUser
AWS CLI
Invoke-WebRequest -Uri "https://awscli.amazonaws.com/AWSCLIV2.msi" -OutFile "AWSCLIV2.msi"
Start-Process msiexec.exe -ArgumentList "/i AWSCLIV2.msi /qn" -wait
$env:Path = [System.Environment]::GetEnvironmentVariable('Path', 'Machine')
Write-Output $Env:Path
aws --version
Python 3.11.3
Invoke-WebRequest -Uri "https://www.python.org/ftp/python/3.11.3/python-3.11.3-amd64.exe" -OutFile "python-3.11.3-amd64.exe"
Start-Process python-3.11.3-amd64.exe -ArgumentList "/quiet InstallAllUsers=1 PrependPath=1 Include_test=0" -wait
$env:Path = [System.Environment]::GetEnvironmentVariable('Path', 'Machine')
Write-Output $Env:Path
python --version
PowerShell 7.3.3
Invoke-WebRequest -Uri "https://github.com/PowerShell/PowerShell/releases/download/v7.3.3/PowerShell-7.3.3-win-x64.msi" -OutFile "PowerShell-7.3.3-win-x64.msi"
Start-Process msiexec.exe -ArgumentList "/package PowerShell-7.3.3-win-x64.msi /qn" -wait
$env:Path = [System.Environment]::GetEnvironmentVariable('Path', 'Machine')
Write-Output $Env:Path
Choco
# Installation
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
# make Refreshenv available
$env:ChocolateyInstall = Convert-Path "$((Get-Command choco).Path)\..\.."
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
# Later, you can refresh Env Var after installing new package
refreshenv
Git Cli, Vim …
choco install -y git
choco install -y vim
Reconfigurer File Explorer
# Reconfigure File Explorer (show hidden files)
$key = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced'
Set-ItemProperty $key Hidden 1
Set-ItemProperty $key HideFileExt 0
Set-ItemProperty $key ShowSuperHidden 1
FIN