Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Add Registry Keys
- $regPath1 = "HKLM:\SOFTWARE\WOW6432Node\Citrix\WebSocketService"
- $regPath2 = "HKLM:\SOFTWARE\Microsoft\Teams"
- $regPath3 = "HKLM:\Software\Policies\Microsoft\Windows\Appx"
- $processWhitelistKey = "ProcessWhitelist"
- $teamsWVDKey = "IsWVDEnvironment"
- $allowAllTrustedAppsKey = "AllowAllTrustedApps"
- # Create the registry key for ProcessWhitelist if it doesn't exist and set the value
- if (-not (Test-Path $regPath1)) {
- New-Item -Path $regPath1 -Force
- }
- Set-ItemProperty -Path $regPath1 -Name $processWhitelistKey -Value "msedgewebview2.exe" -Type MultiString
- # Create the registry key for IsWVDEnvironment if it doesn't exist and set the value
- if (-not (Test-Path $regPath2)) {
- New-Item -Path $regPath2 -Force
- }
- Set-ItemProperty -Path $regPath2 -Name $teamsWVDKey -Value 0 -Type DWord
- # Create the registry key for AllowAllTrustedApps if it doesn't exist and set the value
- if (-not (Test-Path $regPath3)) {
- New-Item -Path $regPath3 -Force
- }
- Set-ItemProperty -Path $regPath3 -Name $allowAllTrustedAppsKey -Value 1 -Type DWord
- # Create the temp directory if it doesn't exist
- $tempDir = "C:\temp\teams"
- if (-not (Test-Path $tempDir)) {
- New-Item -Path $tempDir -ItemType Directory
- }
- # Download files
- $files = @(
- @{url = "https://go.microsoft.com/fwlink/?linkid=2243204&clcid=0x409"; path = "$tempDir\teamsbootstrapper.exe"},
- @{url = "https://go.microsoft.com/fwlink/?linkid=2196106"; path = "$tempDir\MSTeams-x64.msix"}
- )
- $webClient = New-Object System.Net.WebClient
- foreach ($file in $files) {
- try {
- $webClient.DownloadFile($file.url, $file.path)
- Write-Output "Successfully downloaded $($file.url)"
- } catch {
- Write-Error "Failed to download $($file.url): $_"
- }
- }
- # Clean up
- $webClient.Dispose()
- # Check if the files were downloaded successfully
- if (-not (Test-Path "$tempDir\teamsbootstrapper.exe")) {
- Write-Error "Failed to download teamsbootstrapper.exe"
- exit 1
- }
- if (-not (Test-Path "$tempDir\MSTeams-x64.msix")) {
- Write-Error "Failed to download MSTeams-x64.msix"
- exit 1
- }
- # Uninstall Teams
- & "$tempDir\teamsbootstrapper.exe" -x
- # Install Teams
- & "$tempDir\teamsbootstrapper.exe" -p -o "$tempDir\MSTeams-x64.msix"
- If (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator') ){
- Write-Error "Need to run as administrator. Exiting.."
- exit 1
- }
- # Get Version of currently installed new Teams Package
- if (-not ($NewTeamsPackageVersion = (Get-AppxPackage -Name MSTeams).Version)) {
- Write-Host "New Teams Package not found. Please install new Teams from https://aka.ms/GetTeams ."
- exit 1
- }
- Write-Host "Found new Teams Version: $NewTeamsPackageVersion"
- # Get Teams Meeting Addin Version
- $TMAPath = "{0}\WINDOWSAPPS\MSTEAMS_{1}_X64__8WEKYB3D8BBWE\MICROSOFTTEAMSMEETINGADDININSTALLER.MSI" -f $env:programfiles,$NewTeamsPackageVersion
- if (-not ($TMAVersion = (Get-AppLockerFileInformation -Path $TMAPath | Select-Object -ExpandProperty Publisher).BinaryVersion))
- {
- Write-Host "Teams Meeting Addin not found in $TMAPath."
- exit 1
- }
- Write-Host "Found Teams Meeting Addin Version: $TMAVersion"
- # Install parameters
- $TargetDir = "{0}\Microsoft\TeamsMeetingAddin\{1}\" -f ${env:ProgramFiles(x86)},$TMAVersion
- $params = '/i "{0}" TARGETDIR="{1}" /qn ALLUSERS=1' -f $TMAPath, $TargetDir
- # Start the install process
- write-host "executing msiexec.exe $params"
- Start-Process msiexec.exe -ArgumentList $params
- write-host "Please confirm install result in Windows Eventlog"
Advertisement
Add Comment
Please, Sign In to add comment