1

https://danielsmon.com/2020/04/02/multiple-ms-teams-accounts-on-the-desktop/

 1 year ago
source link: https://gist.github.com/DanielSmon/cc3fa072857f0272257a5fd451768c3a
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

For running multiple MS Teams accounts side by side. Save this with the name of the MS Teams profile you wish to use. When launched, a folder will be created in your user profile. See https://danielsmon.com/2020/04/02/multiple-ms-teams-accounts-on-the-desktop/. · GitHub

Instantly share code, notes, and snippets.

For running multiple MS Teams accounts side by side. Save this with the name of the MS Teams profile you wish to use. When launched, a folder will be created in your user profile. See https://danielsmon.com/2020/04/02/multiple-ms-teams-accounts-on-the-desktop/.

I understand that electron apps like Teams are user-profile-specific. So this is a very simple and effective hack.
Many thanks! Has been a lifesaver for me!

Awesome! I use this on my Windows machine.

I need something like this for MacOS as well.... Any pointers?

Fantastic! Thanks a lot.

Can we use the trick to have at the same time

  • one instance of teams opened with the profile of my organization ([email protected])
  • one instance of teams opened with the profile of another organization ([email protected]), not sure if a profile of the org B can be created on a machine joined in org A

@gidifede yes, this is what I'm doing everyday: I open my computer and start Teams as usual through the Start Menu. Then I launch my second Teams using this script, connected to my other tenant.

What's tricky is that the default Teams app will be the one launched without the script, it means that if you click on a Teams meeting link, it is the default app that will be launched. You need to keep that in mind or you'll face some surprises.

this is awesome Thanks!!!

This cmd was working perfectly for me and my colleagues but recently we have been getting the following JavaScript error. I assume that either the OS or Teams was updated by our corporate IT.

Error: Failed to get 'downloads path
at Object.<anonymous> (C:\Users\[username]\AppData\Local\Microsoft\Teams\current\resources\app.asar\lib\loca...:54)
at Module.compile (C:\Users\[username]\AppData\Local\Microsoft\Teams\current\resources\app.asar\externa...:36)
at Object.Module.extensions..js (internal/modules/cjs/loader.js:986:10)
at Module.load (internal/modules/cjs/loader.js:816:32)
at Function.Module._load (electron/js2c/asar.js:748:26)
at Module.require (internal/modules/cjs/loader.js:853:19)
at require (C:\Users\[username]\AppData\Local\Microsoft\Teams\current\resources\app.asar\externa...:28)
at Object.<anonymous> (C:\Users\[username]\AppData\Local\Microsoft\Teams\current\resources\app.asar\lib\loca...:20)
at Module.compile (C:\Users\[username]\AppData\Local\Microsoft\Teams\current\resources\app.asar\externa...:36)

Any ideas on a cause or fix?

Jup, this hit me too. Sadly not working anymore.

xLAva commented on May 17, 2021

edited

There is a workaround - create a "Downloads" folder in
%LOCALAPPDATA%\Microsoft\Teams\CustomProfiles\%MSTEAMS_PROFILE%\

Author

DanielSmon commented on May 17, 2021

There is a workaround - create a "Downloads" folder in
%LOCALAPPDATA%\Microsoft\Teams\CustomProfiles\%MSTEAMS_PROFILE%\

Thanks @xLAva, since this was reported I've now also started experiencing this issue. Creating the downloads folder fixed it for me too. I've now added a mkdir command on line 12 to take care of this in the main script. Cheers!

For what it's worth, here's the same script in Powershell:

$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"

thanks @DanielSmon . thanks @dfbaskin for the powershell port.

great work. really appreciate it. this solved so many of my headaches.

cardio63 commented on Feb 15

This worked for me today using the latest version of Teams.

TritusIX commented on Mar 11

Check out my profile https://github.com/TritusIX I fixed the problem with unavailable "Desktop" folder. @DanielSmon it would be great if you could add the fix into main script.

Author

DanielSmon commented on Mar 22

Hey @TritusIX, sorry I can't see anything on your GitHub profile? Do you have a direct link? Thanks

Author

DanielSmon commented on Mar 31

Thanks @TritusIX, now added!

After using two Team's profiles for about 6 weeks, Outlook started using the wrong Teams profile to create Teams meeting invites.

Outlook signed into [email protected]
Teams1 signed into [email protected]
Teams2 signed into [email protected]

When I create a new meeting request in Outlook and insert the Teams link, it inserts a link from [email protected] not the correct account. Any have a fix for this?

It'll use your default teams, i.e the process / instance that runs normally without using the script. You'll just have to make sure your default Teams is the one thst you want to use with Outlook.

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


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK