-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathinstall-MSTeamsForVDI.ps1
More file actions
61 lines (47 loc) · 2.01 KB
/
Copy pathinstall-MSTeamsForVDI.ps1
File metadata and controls
61 lines (47 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<#
.SYNOPSIS
Sets MS Teams AVD mode, uninstalls existing teams and installs the latest including required web rtc redir
.NOTES
author: Jos Lieben / jos@lieben.nu
url: https://www.lieben.nu
copyright: JSolve B.V., unlimited free use for anyone
Created: 02/02/2023
#>
#teams download url
$teamsDownloadUrl = "https://teams.microsoft.com/downloads/desktopurl?env=production&plat=windows&arch=x64&managedInstaller=true&download=true"
#redirector download Url
$redirectorDownloadUrl = "https://aka.ms/msrdcwebrtcsvc/msi"
$workingDir = Join-Path $Env:TEMP -ChildPath "TeamsInstall"
if(!(Test-Path -Path $workingDir)){
New-Item $workingDir -ItemType Directory -Force > $null
}
$teamsInstaller = Join-Path -Path $workingDir -ChildPath "teamsinstaller.msi"
$redirInstaller = Join-Path -Path $workingDir -ChildPath "redirInstaller.msi"
$logfile = "$env:windir\logs\teamsandwebrtcinstall.log"
#download both installers
Invoke-WebRequest -UseBasicParsing -Uri $teamsDownloadUrl -OutFile $teamsInstaller
Invoke-WebRequest -UseBasicParsing -Uri $redirectorDownloadUrl -OutFile $redirInstaller
#uninstall existing teams versions if found
wmic product where "name like 'Teams Machine-wide Installer'" call uninstall /nointeractive
Start-Sleep -Seconds 20
# Stop msiexec.exe if process is running before installation
foreach ($_ in (Get-Process | Where-Object { $_.Name -like "*msiexec*" })) {
$ProcessID = $_.Id
Stop-Process -Id $ProcessID -Force
}
#set AVD regkey for media optimization
if(!(Test-Path "HKLM:\SOFTWARE\Microsoft\Teams")){
New-Item -Path "HKLM:\Software\Microsoft" -Name "Teams" -Force
}
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Teams" -Name "IsWVDEnvironment" -Value 1 -Force
Start-Process `
-FilePath "$redirInstaller" `
-ArgumentList "/quiet /qn" `
-Wait `
-Passthru
Start-Process `
-FilePath "$teamsInstaller" `
-ArgumentList "/quiet /qn /L*v! $logfile ALLUSER=1 ALLUSERS=1" `
-Wait `
-Passthru
Remove-Item $workingDir -Force -Recurse -Confirm:$False