WinGetInfoObject.psm1

function Get-WinGetInfo {
        param(
            [string]$Name
        )
    $WingetRawOutput = winget show $Name --disable-interactivity
    $WingetRawOutput | Out-File -FilePath ".\WinGetShowOutputTemp.txt" -Force
    $outputString = Get-Content -Path ".\WinGetShowOutputTemp.txt"
    $MainHashTableObj = New-Object -TypeName pscustomobject
    $i = 1
    foreach ($splitStr in $outputString){
        if ($splitStr -match "Found"){
            $MainHashTableObj | Add-Member -MemberType "NoteProperty" -Name "Name" -Value $splitStr.Replace("Found ","") -Force
        }
        if ($splitStr -like "Description:"){
            Write-Host "IN DESC IF"
            $curIndex = $outputString.IndexOf("Description:")
            if ($outputString[$curIndex + 1] -match "Homepage:"){
                $nextIndex = $curIndex + 1
                $STRSplit = $splitStr | Split-String -RegexSeparator ":\s"
                $MainHashTableObj | Add-Member -MemberType "NoteProperty" -Name $STRSplit[0] -Value $STRSplit[1] -Force
            }
            else{
                Write-Host "IN DESC ELSE"
            if ($outputString[$curIndex + 2] -match "Homepage:"){
                $nextIndex = $curIndex + 2
            }
            if ($outputString[$curIndex + 3] -match "Homepage:"){
                $nextIndex = $curIndex + 3
            }
            if ($outputString[$curIndex + 4] -match "Homepage:"){
                $nextIndex = $curIndex + 4
            }
            if ($outputString[$curIndex + 5] -match "Homepage:"){
                $nextIndex = $curIndex + 5
            }
            if ($outputString[$curIndex + 6] -match "Homepage:"){
                $nextIndex = $curIndex + 6
            }
            if ($outputString[$curIndex + 7] -match "Homepage:"){
                $nextIndex = $curIndex + 7
            }
            if ($outputString[$curIndex + 8] -match "Homepage:"){
                $nextIndex = $curIndex + 8
            }
            if ($outputString[$curIndex + 9] -match "Homepage:"){
                $nextIndex = $curIndex + 9
            }
            if ($outputString[$curIndex + 10] -match "Homepage:"){
                $nextIndex = $curIndex + 10
            }
            for ($i=$curIndex + 1;$i -lt $nextIndex;$i++){
            $TempHold += $outputString[$i]
            }
            $MainHashTableObj | Add-Member -MemberType "NoteProperty" -Name "Description" -Value $TempHold.ToString().Replace(" ","")
        }
        }
        elseif ($splitStr -match "Tags:"){
            $curIndex = $outputString.IndexOf("Tags:")
            $nextIndex = $outputString.IndexOf("Installer:")
            for ($i=$curIndex + 1;$i -lt $nextIndex;$i++){
                $TempHold2 += ($outputString[$i].Replace(" ","") + ";")
                }
                $MainHashTableObj | Add-Member -MemberType "NoteProperty" -Name "Tags" -Value $TempHold2 -Force
        }
        elseif ($splitStr -match "Installer:"){
            $curIndex = $outputString.IndexOf("Installer:")
                $nextIndex = $curIndex + 4
            for ($i=$curIndex + 1;$i -lt $nextIndex;$i++){
                $TempHold3 += $outputString[$i]
                }
            foreach ($Temp in $TempHold3){
                $SplitTemp = $Temp | Split-String -RegexSeparator ":\s"
            $MainHashTableObj | Add-Member -MemberType "NoteProperty" -Name $SplitTemp[0].Replace(" ","") -Value $SplitTemp[1] -Force
            }
        }
        else {
            $TempVer = $splitStr | Split-String -RegexSeparator ":\s"
            if ($TempVer[0] -isnot [char] -and $null -ne $TempVer[0]){
            $MainHashTableObj | Add-Member -MemberType "NoteProperty" -Name $TempVer[0].Replace(" ","") -Value $TempVer[1] -Force -ErrorAction SilentlyContinue
        }
    }
        }
    return $MainHashTableObj
    }

Export-ModuleMember -Function Get-WinGetInfo