Initialize-Winget

1.3

This script ensures WinGet is properly installed and functional. It will:
1. Verify WinGet can find packages using the 'Microsoft.WinGet.Client' module.
2. Attempt to repair WinGet if package search fails.
3. Install WinGet and its dependencies if repair fails.
4. Locate and verify the winget.exe path.

The script also ensures that necessary helper module 'Microsoft.W
This script ensures WinGet is properly installed and functional. It will:
1. Verify WinGet can find packages using the 'Microsoft.WinGet.Client' module.
2. Attempt to repair WinGet if package search fails.
3. Install WinGet and its dependencies if repair fails.
4. Locate and verify the winget.exe path.

The script also ensures that necessary helper module 'Microsoft.WinGet.Client' is installed and imported.

Show more

Installation Options

Copy and Paste the following command to install this package using PowerShellGet More Info

Install-Script -Name Initialize-Winget

Copy and Paste the following command to install this package using Microsoft.PowerShell.PSResourceGet More Info

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deploy all the dependencies to Azure Automation. Learn More

Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More

Owners

Package Details

Author(s)

  • Jonathan Pitre

Tags

Winget Intune Autopilot PowerShell Automation

Functions

Get-WinGetPath

Dependencies

This script has no dependencies.

Release Notes

1.3 - 2025-06-02
- Fixed try/catch block
- Improved logging and error handling
- Improved winget.exe path detection
1.2 - 2025-05-30
- Removed dependency on PSAppDeployToolkit.WinGet
- Fixed error "Find-ADTWinGetPackage -Id Microsoft.AppInstaller -Count 1 -Source winget"
- Improved logging and error handling
1.1 - 2025-05-30
- Fixed "Failed to execute Winget command: Cannot validate argument on parameter 'Id'"
- Improved logging and error handling
1.0 - 2025-05-28
- Initial release

FileList

Version History

Version Downloads Last updated
1.3 (current version) 231 6/2/2025
1.2 6 5/30/2025
1.1 6 5/30/2025
1.0 7 5/29/2025