Skip to content

Instantly share code, notes, and snippets.

@dfbaskin
Created August 16, 2021 14:48
Show Gist options
  • Save dfbaskin/1a7aac9435d0374ec4346f4d2340b2a8 to your computer and use it in GitHub Desktop.
Save dfbaskin/1a7aac9435d0374ec4346f4d2340b2a8 to your computer and use it in GitHub Desktop.
Run multiple Teams Desktop applications in Windows
$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"
@dfbaskin
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment