Guest User

Reinstall New Teams for VDI

a guest
Jun 26th, 2025
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.60 KB | None | 0 0
  1. # Add Registry Keys
  2. $regPath1 = "HKLM:\SOFTWARE\WOW6432Node\Citrix\WebSocketService"
  3. $regPath2 = "HKLM:\SOFTWARE\Microsoft\Teams"
  4. $regPath3 = "HKLM:\Software\Policies\Microsoft\Windows\Appx"
  5. $processWhitelistKey = "ProcessWhitelist"
  6. $teamsWVDKey = "IsWVDEnvironment"
  7. $allowAllTrustedAppsKey = "AllowAllTrustedApps"
  8.  
  9. # Create the registry key for ProcessWhitelist if it doesn't exist and set the value
  10. if (-not (Test-Path $regPath1)) {
  11. New-Item -Path $regPath1 -Force
  12. }
  13. Set-ItemProperty -Path $regPath1 -Name $processWhitelistKey -Value "msedgewebview2.exe" -Type MultiString
  14.  
  15. # Create the registry key for IsWVDEnvironment if it doesn't exist and set the value
  16. if (-not (Test-Path $regPath2)) {
  17. New-Item -Path $regPath2 -Force
  18. }
  19. Set-ItemProperty -Path $regPath2 -Name $teamsWVDKey -Value 0 -Type DWord
  20.  
  21. # Create the registry key for AllowAllTrustedApps if it doesn't exist and set the value
  22. if (-not (Test-Path $regPath3)) {
  23. New-Item -Path $regPath3 -Force
  24. }
  25. Set-ItemProperty -Path $regPath3 -Name $allowAllTrustedAppsKey -Value 1 -Type DWord
  26.  
  27. # Create the temp directory if it doesn't exist
  28. $tempDir = "C:\temp\teams"
  29. if (-not (Test-Path $tempDir)) {
  30. New-Item -Path $tempDir -ItemType Directory
  31. }
  32.  
  33. # Download files
  34. $files = @(
  35. @{url = "https://go.microsoft.com/fwlink/?linkid=2243204&clcid=0x409"; path = "$tempDir\teamsbootstrapper.exe"},
  36. @{url = "https://go.microsoft.com/fwlink/?linkid=2196106"; path = "$tempDir\MSTeams-x64.msix"}
  37. )
  38.  
  39. $webClient = New-Object System.Net.WebClient
  40.  
  41. foreach ($file in $files) {
  42. try {
  43. $webClient.DownloadFile($file.url, $file.path)
  44. Write-Output "Successfully downloaded $($file.url)"
  45. } catch {
  46. Write-Error "Failed to download $($file.url): $_"
  47. }
  48. }
  49.  
  50. # Clean up
  51. $webClient.Dispose()
  52.  
  53. # Check if the files were downloaded successfully
  54. if (-not (Test-Path "$tempDir\teamsbootstrapper.exe")) {
  55. Write-Error "Failed to download teamsbootstrapper.exe"
  56. exit 1
  57. }
  58.  
  59. if (-not (Test-Path "$tempDir\MSTeams-x64.msix")) {
  60. Write-Error "Failed to download MSTeams-x64.msix"
  61. exit 1
  62. }
  63.  
  64. # Uninstall Teams
  65. & "$tempDir\teamsbootstrapper.exe" -x
  66.  
  67. # Install Teams
  68. & "$tempDir\teamsbootstrapper.exe" -p -o "$tempDir\MSTeams-x64.msix"
  69.  
  70.  
  71. If (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator') ){
  72. Write-Error "Need to run as administrator. Exiting.."
  73. exit 1
  74. }
  75.  
  76. # Get Version of currently installed new Teams Package
  77. if (-not ($NewTeamsPackageVersion = (Get-AppxPackage -Name MSTeams).Version)) {
  78. Write-Host "New Teams Package not found. Please install new Teams from https://aka.ms/GetTeams ."
  79. exit 1
  80. }
  81. Write-Host "Found new Teams Version: $NewTeamsPackageVersion"
  82.  
  83. # Get Teams Meeting Addin Version
  84. $TMAPath = "{0}\WINDOWSAPPS\MSTEAMS_{1}_X64__8WEKYB3D8BBWE\MICROSOFTTEAMSMEETINGADDININSTALLER.MSI" -f $env:programfiles,$NewTeamsPackageVersion
  85. if (-not ($TMAVersion = (Get-AppLockerFileInformation -Path $TMAPath | Select-Object -ExpandProperty Publisher).BinaryVersion))
  86. {
  87. Write-Host "Teams Meeting Addin not found in $TMAPath."
  88. exit 1
  89. }
  90. Write-Host "Found Teams Meeting Addin Version: $TMAVersion"
  91.  
  92. # Install parameters
  93. $TargetDir = "{0}\Microsoft\TeamsMeetingAddin\{1}\" -f ${env:ProgramFiles(x86)},$TMAVersion
  94. $params = '/i "{0}" TARGETDIR="{1}" /qn ALLUSERS=1' -f $TMAPath, $TargetDir
  95.  
  96. # Start the install process
  97. write-host "executing msiexec.exe $params"
  98. Start-Process msiexec.exe -ArgumentList $params
  99. write-host "Please confirm install result in Windows Eventlog"
Advertisement
Add Comment
Please, Sign In to add comment