PowerShellCrack / WinGetWrapperModule

A wrapper around winget command line utility without using colbalt or third party
MIT License
1 stars 0 forks source link

WinGetWrapperModule

A winget PoSH wrapper without using colbalt or third party

DISCLAIMER

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

Add-AppxPackage -RegisterByFamilyName -MainPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe

https://learn.microsoft.com/en-us/windows/package-manager/winget/#install-winget

Install

Install-Module WinGetWrapper -Force

Cmdlets

Scripts

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

Example #1

Get-WinGetWrapperList -Details | Select -First 1
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

Get-WinGetWrapperList | Test-WinGetWrapperIsUpgradeable
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

Get-WinGetWrapperUpgradeList
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

Start-WinGetWrapperAppUpdate 
Name       ExitCode Status
----       -------- ------
4                 0 Successfully installed

Example #5

Start-WinGetWrapperAppUpdate -Id 'Microsoft.VCRedist.2015+.x64'
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.