TeamsOnWVD.psm1
########## Teams for Windows Virtual Desktop # Author : Yannick Dils # Create Date : 09/04/2020 # Version : 2.0 ########## function install-teams64bit { #region step 1 - Import regkeys Write-Host "Step 1 : Checking the required registry keyssn" -ForegroundColor Cyan $KeyPath = "HKLM:\SOFTWARE\Microsoft\Teams\" $WVDKey = "IsWVDEnvironment" IF(!(Test-Path $KeyPath)) { Write-Host "The path does not exist, we will create this path now" -ForegroundColor red New-Item -Path $KeyPath -Force New-ItemProperty -Path $KeyPath -Name $WVDKey -PropertyType "DWORD" -Value "1" -Force } else { Write-Host "The path already exists, we don't need to create this path now" -ForegroundColor Green New-ItemProperty -Path $KeyPath -Name $WVDKey -PropertyType "DWORD" -Value "1" -Force } #endregion step 1 #region step 2 - Download the Teams MSI Package $DownloadLink = "https://statics.teams.cdn.office.net/production-windows-x64/1.3.00.4461/Teams_windows_x64.msi" $TempDir = "C:\Temp" $Output = "C:\Temp\teams64.msi" $Logfile = $TempDir + "\logfile.txt" $Path = Test-Path $TempDir If ($Path -eq $true) { Write-Host "Step 2 : The C:\Temp path already exists, no need to create one" -ForegroundColor Cyan } Else { Write-host "Step 2 : We are creating a temp directory C:\Temp" -ForegroundColor Cyan $DontShow = mkdir $TempDir } (New-Object System.Net.WebClient).DownloadFile($DownloadLink, $output) cd $TempDir #endregion step 2 #region step 3 - Install Teams MSI Write-Host "Step 3 : Let us install Teams" -ForegroundColor Cyan msiexec /i $Output /l*v $Logfile ALLUSER=1 ALLUSERS=1 #endregion step 3 } function install-teams32bit { #region step 1 - import regkeys Write-Host "Step 1 : Let us first set a couple or registry keysn" -ForegroundColor Cyan $KeyPath = "HKLM:\SOFTWARE\Microsoft\Teams\" $WVDKey = "IsWVDEnvironment" IF(!(Test-Path $KeyPath)) { Write-Host "The path does not exist, we will create this path now" -ForegroundColor red New-Item -Path $KeyPath -Force New-ItemProperty -Path $KeyPath -Name $WVDKey -PropertyType "DWORD" -Value "1" -Force } else { Write-Host "The path already exists, we don't need to create this path now" -ForegroundColor Green New-ItemProperty -Path $KeyPath -Name "$WVDKey" -PropertyType "DWORD" -Value "1" -Force } #endregion step 1 #region step 2 - Download the Teams MSI Package $DownloadLink = "https://statics.teams.cdn.office.net/production-windows/1.3.00.4461/Teams_windows.msi" $TempDir = "C:\Temp" $Output = "C:\Temp\teams32.msi" $Logfile = $TempDir + "\logfile.txt" $Path = Test-Path $TempDir If ($Path -eq $true) { Write-Host "Step 2 : The C:\Temp path already exists, no need to create one" -ForegroundColor Cyan } Else { Write-host "Step 2 : We are creating a temp directory C:\Temp" -ForegroundColor Cyan $DontShow = mkdir $TempDir } (New-Object System.Net.WebClient).DownloadFile($DownloadLink, $output) cd $TempDir #endregion step 2 #region step 3 - Install Teams MSI Write-Host "Step 3 : Let us install Teams" -ForegroundColor Cyan msiexec /i $Output /l*v $Logfile ALLUSER=1 ALLUSERS=1 #endregion step 3 } function remove-teams64bit { #region step 1 - Uninstall Teams MSI Write-Host "Step 1 : Let us un-install Teams" -ForegroundColor Cyan msiexec /x $Output /l*v $Logfile ALLUSER=1 ALLUSERS=1 #endregion step 1 #region step 2 - Remove regkeys Write-Host "Step 2 : Checking the required registry keyssn" -ForegroundColor Cyan $KeyPath = "HKLM:\SOFTWARE\Microsoft\Teams\" $WVDKey = "IsWVDEnvironment" IF(!(Test-Path $KeyPath)) { Write-Host "The path does not exist, we will create this path now" -ForegroundColor red Remove-Item -Path $KeyPath -Force Remove-ItemProperty -Path $KeyPath -Name $WVDKey -PropertyType "DWORD" -Value "1" -Force } else { Write-Host "The path already exists, we don't need to create this path now" -ForegroundColor Green Remove-ItemProperty -Path $KeyPath -Name $WVDKey -PropertyType "DWORD" -Value "1" -Force } #endregion step 2 } |