Skip to content

Language Specific Code (function Test-WinGetApp) #9

@theITcloudAdmn

Description

@theITcloudAdmn

If working on WinSystemLocale not US/EN, this is not going to work:
if ($line -like "*No installed package found*") {
https://github.com/byteben/MEM/blob/e85ebf4181d913701c27a67d22dfaf5790dc4381/Reset-Appx.ps1#L664C35-L664C61

For example in german it says:

Es wurde kein installiertes Paket gefunden, das den Eingabekriterien entspricht.

Maybe a better idea is to work with the exit code of
$winGetTest = & .\$winGetBinary list --id $winGetAppId --source $winGetAppSource --accept-source-agreements
(if this fails, $LASTEXITCODE is -1978335212)

For example:

Set-Location $winGetPath
& .\$winGetBinary list --id $winGetAppId --source $winGetAppSource --accept-source-agreements

if ($LASTEXITCODE -eq "0") {
   Write-Host "The 'WinGet list' command line indicated the '$($winGetAppName)' app, with Id '$($winGetAppId)', is installed"
   Write-LogEntry -logEntry "The 'WinGet list' command line indicated the '$($winGetAppName)' app, with Id '$($winGetAppId)', is installed" -logID $logID
   return @{Result = 'Installed' }
}
else {
   Write-Host "The 'WinGet list' command line indicated the '$($winGetAppName)' app, with Id '$($winGetAppId)', is not installed"
   Write-LogEntry -logEntry "The 'WinGet list' command line indicated the '$($winGetAppName)' app, with Id '$($winGetAppId)', is not installed" -logID $logID
   return @{Result = 'Not Installed' }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions