Forum Discussion
David Phillips
Apr 01, 2021Steel Contributor
How are you keeping Teams Machine-Wide Installer updated?
Now that Message Center # MC245996 is going into effect, users with new-to-them PCs with older install dates of Office are starting to see the update screen with the Teams Upgrade button. Since Offi...
HappyNerd125
Apr 13, 2022Copper Contributor
The solution that i came up with is to use a logon script.
The script utilizes winget to check for teams. Installs if required and upgrades if available.
I have pulled out all the logging since it contained network information so i would suggest you create some logging to check the scripts behaviour.
I run it with a GPO against a Computer OU with a User configuration and loop back applied.
it has installed and upgraded teams litterally thousands of times and since its introduction we haven't had a single user log a ticket due to teams been out of date.
Hope it helps
function Get-WinGet {
[string[]]$Teams = @(winget list Teams --accept-source-agreements | where-object{$_ -match "Microsoft.teams"})[0]
[int]$count = @($teams.split(" ") | where-object{$_ -match "[0-9]"}).count
Return $count
}
[string]$testpath = ($env:USERPROFILE + "\AppData\Local\Microsoft\Teams\current\teams.exe")
if(!(test-path $testpath)){
#install if teams doesn't exist at all
[int]$int = "0"
while(!(test-path $testpath) `
-and `
$int -lt 8){
winget install --id "microsoft.teams" --accept-source-agreements
#wait 10 seconds to allow settings to upgdate to ensure the winget list command works
start-sleep -seconds 20
if(test-path $testpath){
}
$int++
}
}else{
#check if upgrade required
[int]$teams = get-winget
#update teams if it is out of date.
if($teams -gt 1){
winget install --id Microsoft.Teams
}
}
- pradeepjoshi231985Jan 25, 2024Copper Contributor
Hello
I Ran the script on my system, pls see the below error message I am getting.
Any Advise!
Thank You.
Pradeep
- The1GuyMar 29, 2024Copper Contributorin powersehll in admin mode,
# install the Teams from the Original Windows Package
winget install XP8BT8DW290MPQ --accept-package-agreements --accept-source-agreements
#then check if teams is present
winget search "Teams"
then the upper scrpt wil works flawlessy to update it.