winget-cli
winget-cli copied to clipboard
Return a version object in Get-WinGetVersion
Description of the new feature / enhancement
Get-WinGetVersion returns a string for the version with the "v" as the first character. It should probably be returning a version object.
Proposed technical implementation details
No response
I would have it return a rich object.
Function Get-PSWinGetVersion {
[CmdletBinding()]
param ( )
$Module = Get-Module -Name Microsoft.Winget.Client
[Version]$WingetVersion = (winget -v).Substring(1)
$OS = Get-CimInstance -ClassName Win32_OperatingSystem -Property Caption
[PSCustomObject]@{
PSTypeName = 'PSWinGetVersion'
ModuleVersion = $Module.Version
WingetVersion = $WinGetVersion
WinGetPath = (Get-Command winget).Source
PSVersion = $PSVersionTable.PSVersion
OperatingSystem = $os.Caption
ComputerName = $env:COMPUTERNAME
}
}
This gives me good information for troubleshooting or documentation.