====== Windows Package Manager (winget) ======
* [[https://github.com/microsoft/winget-cli.git|Windows Package Manager (winget)]]: Windows Paketverwaltung (Idee die Microsoft von AppGet [[https://keivan.io/the-day-appget-died/|geklaut]] hat)
* [[https://winstall.app/|winstall]]: Winget kann entweder ein Paket auf einmal installieren oder mit einer json-Datei mehrere Pakete "importieren". Mit der Webanwendung winstall, kann man schnell und einfach eine Datei für den Import erstellen.
* **winget**: Quelle msstore entfernen: ''%%winget source remove msstore%%''
* David's Pack: [[https://winstall.app/packs/2PxYJVs6r]]
* ''%%winget import --ignore-versions -i $env:userprofile/Downloads/winstall-0000.json%%''
===== Configuration =====
**Tab Completion in PowerShell**: [[https://docs.microsoft.com/windows/package-manager/winget/tab-completion]]
Pfad zur Konfigurationsdatei: ''%%$env:localappdata/Packages/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe/LocalState/settings.json%%''
oder mit dem Befehl öffnen:
> winget settings
{
"$schema": "https://aka.ms/winget-settings.schema.json",
// For documentation on these settings, see: https://aka.ms/winget-settings
"experimentalFeatures": {
"dependencies": true,
"directMSI": true,
"experimentalARG": true,
"experimentalCMD": true,
"pinning": true
},
"installBehavior": {
"disableInstallNotes": true,
"preferences": {
"locale": [
"en-US"
],
"scope": "machine"
},
"requirements": {}
},
"interactivity": {
"disable": true
},
"network": {
"doProgressTimeoutInSeconds": 30,
"downloader": "wininet"
},
"source": {
"autoUpdateIntervalInMinutes": 5
},
"telemetry": {
"disable": true
},
"visual": {
"progressBar": "accent"
}
}
===== Installation =====
==== Windows Server ====
* Winget wird offiziell nicht auf Windows Server unterstützt.
* Winget benötigt eigentlich "App Execution Aliases" und kann deshalb nur auf Windows Server 2022 oder neuer ohne Probleme installiert werden
* Winget läuft nicht auf Windows Server Versionen, die älter sind als 2019 und kann mit einigen Workarounds auf 2019 lauffähig gemacht werden
[[https://gist.github.com/masterflitzer/08622ffc98242cf6453fbfd4b8df1631]]
$ErrorActionPreference = 'Stop'
$info = Get-ComputerInfo -Property @("WindowsInstallationType", "WindowsVersion")
if ($info.WindowsInstallationType -ne "Server") {
write-host "This script is only intended for use on Windows Server because installation of winget is not officially supported there!"
return
}
# Microsoft.UI.Xaml: https://www.nuget.org/packages/Microsoft.UI.Xaml
# Microsoft.VCLibs: https://docs.microsoft.com/troubleshoot/developer/visualstudio/cpp/libraries/c-runtime-packages-desktop-bridge#how-to-install-and-update-desktop-framework-packages
# WinGet: https://github.com/microsoft/winget-cli#manually-update
# update links manually
$msuixaml = "https://www.nuget.org/api/v2/package/Microsoft.UI.Xaml/2.7.1"
$vclibs = "https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx"
$winget = "https://github.com/microsoft/winget-cli/releases/download/v1.2.10271/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
$wingetLicense = "https://github.com/microsoft/winget-cli/releases/download/v1.2.10271/b0a0692da1034339b76dce1c298a1e42_License1.xml"
$msuixamlPath = "$env:tmp/microsoft.ui.xaml.zip"
$msuixamlPathExtracted = "$env:tmp/microsoft-ui-xaml"
$vclibsPath = "$env:tmp/Microsoft.VCLibs.Desktop.appx"
$wingetPath = "$env:tmp/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
$wingetLicensePath = "$env:tmp/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.license.xml"
Invoke-WebRequest -UseBasicParsing -Uri $msuixaml -OutFile $msuixamlPath
Expand-Archive -LiteralPath $msuixamlPath -DestinationPath $msuixamlPathExtracted -Force
$msuixamlExtracted = Get-ChildItem -File -LiteralPath "$msuixamlPathExtracted/tools/AppX/x64/Release" | Where-Object { [regex]::Match($_.Extension, "^\.(appx|msix)(bundle)?$") } | Select-Object -ExpandProperty FullName -First 1
Add-AppxPackage -Path $msuixamlExtracted
Invoke-WebRequest -UseBasicParsing -Uri $vclibs -OutFile $vclibsPath
Add-AppxPackage -Path $vclibsPath
Invoke-WebRequest -UseBasicParsing -Uri $winget -OutFile $wingetPath
Invoke-WebRequest -UseBasicParsing -Uri $wingetLicense -OutFile $wingetLicensePath
Add-AppxPackage -Path $wingetPath