An open API service indexing awesome lists of open source software.

https://github.com/PowerShellCrack/WinGetWrapperModule

A wrapper around winget command line utility without using colbalt or third party
https://github.com/PowerShellCrack/WinGetWrapperModule

Last synced: 6 months ago
JSON representation

A wrapper around winget command line utility without using colbalt or third party

Awesome Lists containing this project

README

        

# WinGetWrapperModule
A winget PoSH wrapper without using colbalt or third party

## DISCLAIMER

- FIRST: have you used [Microsoft.Winget.Client](https://www.powershellgallery.com/packages/Microsoft.WinGet.Client). This is the offical one.
- SECOND: This module is a CONCEPT idea I had to see if it would work.

This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. **THIS SAMPLE CODE AND ANY
RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE**. We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to
reproduce and distribute the object code form of the Sample Code, provided that You agree: (i) to not use Our name, logo, or trademarks to market Your
software product in which the Sample Code is embedded; (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded;
and (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, including attorneys’ fees, that arise or result
from the use or distribution of the Sample Code.

This posting is provided "AS IS" with no warranties, and confers no rights.

## Prerequisites

Winget. The module will check to see if it has been setup. If is is not, the module will attempt to set it up using the command

```powershell
Add-AppxPackage -RegisterByFamilyName -MainPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe
```
https://learn.microsoft.com/en-us/windows/package-manager/winget/#install-winget

## Install

```powershell
Install-Module WinGetWrapper -Force
```

## Cmdlets

- **Get-WinGetWrapperList** :Gets list of apps from winget
- **Get-WinGetWrapperUpgradeList** : Gets list of apps upgradeble
- **Test-WinGetWrapperIsUpgradeable** : Checks if Winget app has and available update
- **Start-WinGetWrapperAppUpdate** : Attempt to update apps using Winget upgrade process
- **Start-WinGetWrapperAllUpdates** : Attempt to update all apps using Winget upgrade process

## Scripts

- **WinGetWrapperScript.ps1** :A simple script to install updates
- **WinGetWrapperSingleScriptFile.ps1** :A script that contains all functions (no module import) for those that want that.

> WARNING!! The single script file not be a updated as the module.

## Example #1

```powershell
Get-WinGetWrapperList -Details | Select -First 1
```
```text
Version : 10.0.22621.2
Publisher : Microsoft Corporation
PublisherUrl : https://www.microsoft.com/
Description : The Windows SDK (10.0.22621.1) for Windows 11 provides the latest headers, libraries, metadata, and tools for building Windows apps.
Homepage : https://developer.microsoft.com/windows/downloads/windows-sdk/
License : Proprietary
PrivacyUrl : https://docs.microsoft.com/en-us/windows/privacy/
Copyright : Copyright (c) Microsoft Corporation. All rights reserved.
InstallerType : exe
InstallerUrl : https://download.microsoft.com/download/7/9/6/7962e9ce-cd69-4574-978c-1202654bd729/windowssdk/winsdksetup.exe
InstallSource : winget
CurrentVersion : 10.0.22000.832
Id : Microsoft.WindowsSDK
Name : Windows Software Development Kit - Windows 10.0.22000.832
InstallerSHA256 : 73fe3cc0e50d946d0c0a83a1424111e60dee23f0803e305a8974a963b58290c0

```
## Example #2
```powershell
Get-WinGetWrapperList | Test-WinGetWrapperIsUpgradeable
```
```text
Microsoft.Edge False
Microsoft Edge Update False
Microsoft.EdgeWebView2Runtime False
Microsoft.549981C3F5F10_8wekyb3d8bbwe False
Microsoft.AV1VideoExtension_8wekyb3d8bbwe False
Microsoft.BingNews_8wekyb3d8bbwe False
Microsoft.BingWeather_8wekyb3d8bbwe False
Microsoft.Teams False
Microsoft.WindowsSDK True
Microsoft.VCRedist.2015+.x64 True
Microsoft.PowerBI False
{dcdaa2fd-eaac-4ab0-9ece-f3df127a6c45}.sdb False
Jabra.Direct False
{fd2b1599-0451-4033-8fdf-545b2e83cc93} False
...
```
## Example #3

```powershell
Get-WinGetWrapperUpgradeList
```
```text
Name : Microsoft Visual C++ 2015-2022 Redistributable (x86)
Id : Microsoft.VCRedist.2015+.x64
Version : 14.32.31326.0
Available : 14.34.31938.0
Source : winget

Name : Windows Software Development Kit - Windows 10.0.22000
Id : Microsoft.WindowsSDK
Version : 10.0.22000.832
Available : 10.0.22621.2
Source : winget
```

## Example #4
```powershell
Start-WinGetWrapperAppUpdate
```
```text
Name ExitCode Status
---- -------- ------
4 0 Successfully installed
```

## Example #5
```powershell
Start-WinGetWrapperAppUpdate -Id 'Microsoft.VCRedist.2015+.x64'
```
```text
Name Id ExitCode Status
---- -- -------- ------
Microsoft Visual C++ 2015-2022 Redistributable (x86) … Microsoft.VCRedist.2015+.x64 -1978335188 Successfully installed..1 package(s) have version numbers that cannot be determined. Use --include-unknown to see all results.
```