Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create WinGet deployment documentation or scripts #4390

Open
rhj-kinsley opened this issue Apr 19, 2024 · 4 comments
Open

Create WinGet deployment documentation or scripts #4390

rhj-kinsley opened this issue Apr 19, 2024 · 4 comments
Labels
Issue-Docs It's a documentation issue that really should be on MicrosoftDocs PowerShell Issue related to WinGet PowerShell Module or cmdlet

Comments

@rhj-kinsley
Copy link

rhj-kinsley commented Apr 19, 2024

Brief description of your issue

There seems to be a lack of clear and defined documentation regarding the proper deployment and bootstrapping of WinGet using PowerShell on new machines. The main issue lies with the latest Windows 10/11 ISOs that Microsoft currently ships to manufacturers; WinGet doesn't work out-of-the-box on new deployments using those images and errors out. This is due to the version of the App Installer MSIX package shipping with those ISOs being outdated and not functioning as expected. See issue:

I've been using a PowerShell script of my own to bootstrap/repair WinGet utilizing the Microsoft.WinGet.Client module on new deployments. It seems to work well enough, but I would still prefer clear guidance on whether this is best practice or not.

This is the distilled version of the deployment script I use to repair and bootstrap WinGet.

#Requires -RunAsAdministrator

# Install NuGet package provider to install Microsoft.WinGet.Client module
Install-PackageProvider -Name NuGet -Force

# Install Microsoft.WinGet.Client module
Install-Module -Name Microsoft.WinGet.Client -Repository PSGallery -Force

# Repair WinGet package manager
Repair-WinGetPackageManager -Latest
@rhj-kinsley rhj-kinsley added the Issue-Docs It's a documentation issue that really should be on MicrosoftDocs label Apr 19, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage Issue need to be triaged label Apr 19, 2024
@stephengillie
Copy link

I usually update the App Installer through the Microsoft Store. I'm not sure, but that might be the quickest way to get WinGet going on new installs. It's part of the update process for my VMs, installing all updates from the Microsoft Store, Windows Update, and Defender.

@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs-Triage Issue need to be triaged label Apr 19, 2024
@denelon
Copy link
Contributor

denelon commented Apr 19, 2024

@denelon denelon added the PowerShell Issue related to WinGet PowerShell Module or cmdlet label Apr 19, 2024
@rhj-kinsley
Copy link
Author

rhj-kinsley commented Apr 19, 2024

Gotcha @denelon, and just to be more specific in my case I wish to bootstrap/repair WinGet machine-wide from a full local administrator context, not necessarily from SYSTEM context.

Also, should I add the AllUsers scope flag to the cmdlets just to be more precise in their intent? Finally, is the -Force and -Latest flag recommended in this situation with Repair-WinGetPackageManager? For example.

#Requires -RunAsAdministrator

# Install NuGet package provider to install Microsoft.WinGet.Client module
Install-PackageProvider -Name NuGet -Scope AllUsers -Force

# Install Microsoft.WinGet.Client module
Install-Module -Name Microsoft.WinGet.Client -Repository PSGallery -Scope AllUsers -Force

# Repair WinGet package manager
Repair-WinGetPackageManager -AllUsers -Latest -Force

@denelon
Copy link
Contributor

denelon commented Apr 19, 2024

WinGet being delivered via the App Installer MSIX means "AllUsers" doesn't exactly behave the way it would for an MSI. It should have any negative impact but might not necessarily be required.

The "Latest" argument essentially means grab the newest stable version rather than to just "repair" the current version.

I honestly don't remember why "Force" is required (it's probably an edge case we might hit), so that will likely also stay.

For completeness, there is an "Allow Prerelease" for users who want a preview build rather than stable, but for broad deployment use cases, I wouldn't recommend that one without the user fully understanding the implications of installing a prerelease version of WinGet on a large number of devices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Docs It's a documentation issue that really should be on MicrosoftDocs PowerShell Issue related to WinGet PowerShell Module or cmdlet
Projects
None yet
Development

No branches or pull requests

3 participants