Hi,
According to this article, if script is used, both STDOUT and STDERR should be empty when application is regarded as "not installed"
I've changed the script slightly and you may have a try to see if it works.
if (Test-Path $("${Env:LOCALAPPDATA}"+"\Microsoft\Teams\current\Teams.exe"))
{
$teamsexecutable = get-item ("${Env:LOCALAPPDATA}"+"\Microsoft\Teams\current\Teams.exe")
if (!($teamsexecutable.length -eq 90941720))
{
$teamscurrentversion = ([System.Diagnostics.FileVersionInfo]::GetVersionInfo($teamsexecutable)).ProductVersion
if ([version]::Parse($teamscurrentversion) -ge [version]::Parse("1.4.00.2879"))
{
write-host "installed"
}
else
{
}
}
}
Regards,
Alex
If the response is helpful, please click "Accept Answer" and upvote it.