Created
August 16, 2021 14:48
-
-
Save dfbaskin/1a7aac9435d0374ec4346f4d2340b2a8 to your computer and use it in GitHub Desktop.
Run multiple Teams Desktop applications in Windows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$profileName = [io.path]::GetFileNameWithoutExtension($PSCommandPath) | |
Write-Output "Launching $profileName Teams Profile ..." | |
$userProfile = $env:USERPROFILE | |
$appDataPath = $env:LOCALAPPDATA | |
$customProfile = "$appDataPath\Microsoft\Teams\CustomProfiles\$profileName" | |
$downloadPath = Join-Path $customProfile "Downloads" | |
if (!(Test-Path -PathType Container $downloadPath)) { | |
New-Item $downloadPath -ItemType Directory | | |
Select-Object -ExpandProperty FullName | |
} | |
$env:USERPROFILE = $customProfile | |
Start-Process ` | |
-FilePath "$appDataPath\Microsoft\Teams\Update.exe" ` | |
-ArgumentList '--processStart "Teams.exe"' ` | |
-WorkingDirectory "$appDataPath\Microsoft\Teams" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note, don't reuse the shell after running this code because it changes environment variables, which will make other applications, like VS Code, try to create new profiles as well.