Skip to content

Instantly share code, notes, and snippets.

@pirafrank
Created November 19, 2021 17:04
Show Gist options
  • Save pirafrank/40880dbc3e2dcfbdc1dd817b8880fa66 to your computer and use it in GitHub Desktop.
Save pirafrank/40880dbc3e2dcfbdc1dd817b8880fa66 to your computer and use it in GitHub Desktop.
Powershell script to open another instance of Microsoft Teams desktop application. This script runs the app as another user, you need to create another local Windows user before running the script. Check the link the comments to find out how. Tested on Windows 10 and Microsoft Teams v1.4.00.29469 (64-bit, last updated on 11/19/2021)
# Read me:
#
# You need to do some setup before running this script.
# Check the link below.
#
# Run this script as admin in powershell.
# By the way if you run it in a standard powershell it will
# prompt to open a new shell as admin.
#
# This is an edited version to prompt for secure password instead of storing
# it in the script itself.
#
# Guide and credits: https://techcommunity.microsoft.com/t5/microsoft-teams/solution-microsoft-teams-multiple-accounts-second-account/m-p/548309
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit }
$username = '.\MSTeams'
$securePassword = Read-Host "Please enter password for user $username" -AsSecureString
$credential = New-Object System.Management.Automation.PSCredential $username, $securePassword
Start-Process 'C:\Users\MSTeams\AppData\Local\Microsoft\Teams\Update.exe' '--processStart "Teams.exe"' -Credential $credential
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment