Winget powershell install script on Windows Server #4444
Unanswered
nolme
asked this question in
Show and tell
Replies: 1 comment 2 replies
-
|
The 'O' for the "TAKEOWN" command and the "Administrateurs" for the "ICACLS" command only work with French as the system language |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
based on this topic :
I try to make a full script for using WinGet on Windows Server. All seems to be OK but winget show no output.
Any idea ?
Thanks
Here is the full code (french 1036 & english 1033 are managed) :
`# Paramètre pour forcer la réinstallation
$forceReinstall = $true
Ajustement de la page de code pour l'UTF-8
chcp 1252
Configuration de l'encodage de sortie
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
Installation de NuGet si nécessaire ou forcé
if ($forceReinstall -or -not (Get-PackageProvider -Name NuGet) -or (Get-PackageProvider -Name NuGet).Version -lt 2.8.5.201)
{
Write-Host "Installation de NuGet..."
try
{
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -Confirm:$false -ForceBootstrap
}
catch
{
Write-Error -Message $_.Exception
}
}
else
{
Write-Host "NuGet est déjà à jour."
}
Vérification de la présence de winget ou forcer l'installation
try
{
if ($forceReinstall)
{
throw "Forcing reinstall."
}
winget --version
Write-Host "Winget est déjà installé."
}
catch
{
Write-Host "Installation de Winget..."
# Installation de VCLibs forcée si nécessaire
if ($forceReinstall -or -not (Get-AppxPackage -Name Microsoft.VCLibs.140.00.Desktop))
{
Write-Host "Installation de VCLibs..."
Add-AppxPackage 'https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx'
}
}`
Beta Was this translation helpful? Give feedback.
All reactions