-
I've provisioned winget (along with it's dependency package) into a fresh expanded Windows 10 image. After first boot, I've wanted to use it right away, but winget.exe is not available. I'd like to use winget as a part of a script configured to run as FirstLogonCommands/SynchronousCommand. Now I'm a total noob to provisioning apps, so I've got 2 questions:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I think the reason it isn’t accessible after first boot is that Windows 10 doesn’t include winget, but it can pull it via a Microsoft Store update. Eventually it reaches out in the background to do the update without opening the store, and winget appears along with the other new apps. There’s no real way to know when this happens, although you could use Get-AppxPackage to see when the version of Microsoft.DesktopAppInstaller changes to one that includes winget. To resolve your problem, you can install it silently via a script that uses the packages posted here on GitHub, allowing instant use. I wrote one here, but it’s really just using Add-AppxPackage and downloading winget and the dependency libraries (latest version of the VCLibs for your platform). After running that script, you will have winget available for use immediately, and any further updates will come through the Microsoft Store. |
Beta Was this translation helpful? Give feedback.
-
Ok, I've worked around the issue. The |
Beta Was this translation helpful? Give feedback.
Ok, I've worked around the issue.
At first boot, I re-register Desktop Installer from the the provisioned appx install location with this snippet:
(Get-AppxProvisionedPackage -Online -LogLevel Warnings | Where-Object -Property DisplayName -EQ Microsoft.DesktopAppInstaller).InstallLocation -replace '%SYSTEMDRIVE%', $env:SystemDrive | Add-AppxPackage -Register -DisableDevelopmentMode
The
InstallLocation
property erroneously contains the string%SYSTEMDRIVE%
unexpanded. Updating apps via Store corrects it, but the whole idea was not to depend on Store :)After the command completes, winget is there and working.