Hi Pavel
I ran into this problem a while ago and the solution was to write down the file path, check my below script:
#upgrade Microsoft Teams
#Date 20/9/2022
#this script working with windows 10
#this script working with Microsoft MDM
#By.Khaled Elsayed
write-host " Upgrade Microsoft Teams " -ForegroundColor Green
write-host " don't close this window, it will be close automatically" -ForegroundColor red
write-host "_________________________________________________________"
Set-ExecutionPolicy -ExecutionPolicy Bypass -Force
$ResolveWingetPath = Resolve-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe"
if ($ResolveWingetPath){
$WingetPath = $ResolveWingetPath[-1].Path
}
$config
cd $wingetpath
cmd.exe /c "winget.exe upgrade microsoft.teams --accept-package-agreements --accept-source-agreements --silent --force"
exit
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.