$[Link].
BackgroundColor = "Black"
$[Link] = "White"
Clear-Host
# Vérifier les privilèges administratifs
function Check-Admin {
Write-Host "Checking for Administrative Privileges..."
Start-Sleep -Seconds 3
$currentUser = [[Link]]::GetCurrent()
$principal = New-Object [Link]($currentUser)
if (-not
$[Link]([[Link]]::Administrator)) {
Start-Process powershell -Verb runAs -ArgumentList "-NoProfile -
ExecutionPolicy Bypass -File `"$PSCommandPath`""
exit
}
}
Check-Admin
# Vérification de l'installation de Winget
if (-not (Get-Command winget -ErrorAction SilentlyContinue)) {
Write-Host "Winget is not installed. Loading installation..."
Set-ExecutionPolicy Bypass -Scope Process -Force;
Invoke-WebRequest -Uri
"[Link]
Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle" -OutFile "$env:TEMP\
Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
Add-AppxPackage -Path "$env:TEMP\
Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
}
# List of .NET runtimes
$netRuntimes = @(
"[Link].3_1",
"[Link].5",
"[Link].6",
"[Link].7",
"[Link].8"
)
# List of Visual C++ runtimes
$vcRuntimes = @(
"[Link].2005.x86",
"[Link].2005.x64",
"[Link].2008.x86",
"[Link].2008.x64",
"[Link].2010.x86",
"[Link].2010.x64",
"[Link].2012.x86",
"[Link].2012.x64",
"[Link].2013.x86",
"[Link].2013.x64",
"[Link].2015.x86",
"[Link].2015.x64",
"[Link].2017.x86",
"[Link].2017.x64",
"[Link].2019.x86",
"[Link].2019.x64"
)
# Install .NET runtimes
foreach ($runtime in $netRuntimes) {
Write-Host "Installing $runtime..." -ForegroundColor Yellow
winget install --id $runtime --silent --accept-package-agreements --accept-
source-agreements
}
# Install Visual C++ runtimes
foreach ($runtime in $vcRuntimes) {
Write-Host "Installing $runtime..." -ForegroundColor Yellow
winget install --id $runtime --silent --accept-package-agreements --accept-
source-agreements
}
Write-Host "All runtimes have been successfully installed." -ForegroundColor Green