[Windows] Installation de logiciels en ligne de commande

Google Chrome

$uri = [uri]::new( 'https://dl.google.com/chrome/install/chrome_installer.exe' );
$file = "$env:TEMP\{0}" -f $uri.Segments[-1];
[System.Net.WebClient]::new().DownloadFile( $uri, $file );
Start-Process -FilePath $file -ArgumentList '/silent /install' -Wait;
Remove-Item -LiteralPath $file -ErrorAction 'SilentlyContinue';

System Informer (ex Process Hacker)

System Informer

Process Monitor

# Définir l'URL et le chemin d'installation
$procmonUrl = "https://download.sysinternals.com/files/ProcessMonitor.zip"
$destinationFolder = "$env:ProgramFiles\Sysinternals\Procmon"
$zipFile = "$env:TEMP\ProcessMonitor.zip"

# Créer le dossier de destination si nécessaire
if (-not (Test-Path $destinationFolder)) {
    New-Item -Path $destinationFolder -ItemType Directory -Force
}

# Télécharger l'archive ZIP
Invoke-WebRequest -Uri $procmonUrl -OutFile $zipFile

# Extraire les fichiers
Expand-Archive -Path $zipFile -DestinationPath $destinationFolder -Force

# Supprimer l'archive ZIP
Remove-Item $zipFile

# Optionnel : créer un raccourci sur le bureau
$WshShell = New-Object -ComObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$env:Public\Desktop\Process Monitor.lnk")
$Shortcut.TargetPath = "$destinationFolder\Procmon.exe"
$Shortcut.Save()

Write-Output "Process Monitor installé dans $destinationFolder"

Regshot

# Définir les chemins
$exeUrl = "https://github.com/Seabreg/Regshot/raw/refs/heads/master/Regshot-x64-Unicode.exe"
$installDir = "$env:ProgramFiles\Regshot"
$exePath = Join-Path $installDir "Regshot.exe"
$shortcutPath = "$env:Public\Desktop\Regshot.lnk"

# Créer le dossier d'installation si nécessaire
if (-not (Test-Path $installDir)) {
    New-Item -Path $installDir -ItemType Directory -Force | Out-Null
}

# Télécharger l'exécutable
Invoke-WebRequest -Uri $exeUrl -OutFile $exePath

# Créer un raccourci sur le bureau
$WshShell = New-Object -ComObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut($shortcutPath)
$Shortcut.TargetPath = $exePath
$Shortcut.WorkingDirectory = $installDir
$Shortcut.WindowStyle = 1
$Shortcut.Description = "Regshot Unicode 64-bit"
$Shortcut.Save()

Write-Output "Regshot installé dans $installDir avec un raccourci sur le bureau."