How to disable Microsoft Teams from running at logon

If you landed on this page you are probablly working on packaging Microsoft Teams and have been banging your head against a desk trying to figure out how to disable it from loading at startup. Fortunately for you, I figured out a solution that works 100% of the time.

What do you need?
Node.JS
Microsoft Teams
Notepad++

Where to download?
Node.JS – https://nodejs.org/en/
Microsoft Teams – https://teams.microsoft.com/downloads
Notepad++ – https://notepad-plus-plus.org/

Brief background
Essentially, Microsoft Teams is a webpage in the background. It was developed with Electron which is a framework that lets developers create cross-platform desktop apps with web front-end technologies. Some other popular applications such as Skype, and Visual Studio Code were also built with using this technology.

With Electron apps, most of the source files for the application will be packaged into a file named app.asar. You can open the file in Notepad but you cannot save it since it is a READONLY file. From my experience, any changes made to it via Notepad will crash the app and prevent it from loading.

How do you do it?

  1. Download and install Microsoft Teams
  2. Download and install Node.JS
  3. Open the CMD prompt as an Administrator
  4. Run: npm install -g asar
  5. Run: asar extract "%LOCALAPPDATA%\Microsoft\Teams\current\resources\app.asar" C:\Temp\asar
    Note – Try running “C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Node.js\Node.js command prompt.lnk” if the command prompt does not recognize the ASAR command.
  6. Navigate to C:\Temp\asar\lib
  7. Locate desktopConfigurationManager.js and open the file with Notepad++
  8. Search for OPENATLOGIN (There should be two references) and set the value to FALSE as shown below in the screenshots:
    disable teams at startup
    disable teams at startupli>

    Last but not least, it is time to repackage everything!

  9. Run: asar pack "C:\TEMP\asar" "C:\TEMP\app.asar" --unpack *.node

Now that you have a customized app.asar, you can silently install Teams and also not worry about it launching at startup. See the install script below for an example:

# Install Microsoft Teams
Start-Process "$PSScriptRoot\Teams_windows_x64.exe" -ArgumentList "-s" -Wait

# Copy customized app.asar
Copy "$PSScriptRoot\app.asar" "$env:LOCALAPPDATA\Microsoft\Teams\current\resources\app.asar" -Force

23 Comments

  1. Nice tip. I noticed that the re-packed app.asar was quite a lot larger than the original. In order to pack a new app.asar file which was identical except for the preference change I used this command:

    asar pack “C:\TEMP\asar” “C:\TEMP\app.asar” –unpack {*.node,adal.dll} –unpack-dir node_modules\slimcore\bin

  2. I found another way of stopping teams from running on first login… use group policy (run once) or a login script to create an empty folder called “Teams” in “%userprofile%\AppData\Local\Microsoft\” this will prevent the installer from running on first login.
    for users who then wish to use teams give them a script that will delete this empty folder allowing the installer to run on next login.

    • Jose Espitia

      Luke, I’m not trying to prevent the install from running for users. I am just trying to disable the auto-start application setting by default during the install.

  3. I’m guessing this would be have to be re-done with each update? Teams auto-updates doesn’t it? Once a month? https://support.office.com/en-gb/article/what-s-new-in-microsoft-teams-d7092a6d-c896-424c-b362-a472d5f105de?ui=en-US&rs=en-GB&ad=GB

    • Jose Espitia

      Joe, It shouldn’t be an issue if the user has already launched the application. By that time, the setting should be stored in the user’s profile so it doesn’t need to be reconfigured.

  4. We are also trying to stop Teams from launching when Window starts. I followed the instructions to create the app.asar file, but don’t know how to launch it from a script. I don’t know if this is a powershell script, or something else.

    It also look like the script is meant to stop Teams from launching at startup, but it seems that the directory that the app.asar file is being copied to does not exist until Teams is installed and has launched once.

    Am I missing someting?

    • Jose Espitia

      Leo,
      You just need to run the following Powershell script to install Teams and then copy the app.asar file the user’s local appdata directory:
      # Install Microsoft Teams
      Start-Process "$PSScriptRoot\Teams_windows_x64.exe" -ArgumentList "-s" -Wait

      # Copy customized app.asar
      Copy "$PSScriptRoot\app.asar" "$env:LOCALAPPDATA\Microsoft\Teams\current\resources\app.asar" -Force

      During my testing, the application never auto launched but if it does; I would just exit the process after you copy the app.asar file.

  5. did you try on windows 10? i tried the same but it shows up again.

    • Jose Espitia

      March 12, 2019 at 7:17 pm

      Yes, we deployed Teams to Windows 10 with this method. Did you make sure that Teams was completely removed before reinstalling?

  6. Getting an error running npm install -g asar.
    C:\WINDOWS\system32>npm install -g asar
    npm ERR! code SELF_SIGNED_CERT_IN_CHAIN
    npm ERR! errno SELF_SIGNED_CERT_IN_CHAIN
    npm ERR! request to https://registry.npmjs.org/asar failed, reason: self signed certificate in certificate chain

    npm ERR! A complete log of this run can be found in:
    npm ERR!

  7. hey thanks for this info. my second openatlogin statement isn’t the same as yours any suggestions?

    else if (!this.config.overrideOpenAsHiddenProperty && utility.isWindows()) {
    // Override openAsHidden value to false.
    let appPrefs = {
    ‘openAtLogin’: this.config.appPreferenceSettings.openAtLogin,

    • Jose Espitia

      May 24, 2019 at 7:17 pm

      Phil,
      The screenshot is an example of what the end result should look like. Please modify the statement like this:
      else if (!this.config.overrideOpenAsHiddenProperty && utility.isWindows()) {
      // Override openAsHidden value to false.
      let appPrefs = {
      ‘openAtLogin’: false,

  8. Manuel Martinez

    Hi Jose,

    Thank you so much for your help. Although my second openAtLogin is different. I have:

    class DesktopConfigurationManager {
    constructor() {
    this.defaultAppPrefs = {
    ‘openAtLogin’: utility.isMac() ? false : false,
    // Note: openAsHidden feature is not enabled for Mac
    ‘openAsHidden’: false,
    ‘runningOnClose’: false,
    ‘registerAsIMProvider’: false
    };
    this.rigelAppPrefs = {
    ‘openAtLogin’: false,
    ‘openAsHidden’: false,
    ‘runningOnClose’: false,
    ‘registerAsIMProvider’: false
    };
    this.config = null;
    this.loggingService = LoggingService.getInstance();
    this.shouldSave = false;
    this.load();
    this.logConfigJson(‘Initialization completed. Loaded config = ‘, this.config);
    this.getOrCreateMachineId();
    this.setPreviousWebClientVersionInLoggingService();
    this.setAppVersions();
    // Don’t run in UTs
    if (!process.tests) {
    utility.setIntervalWithBackoff(() => { return this.saveTask(); }, 5 * constants.timeInMiliseconds.second, (n) => utility.exponentialFunc(n, constants.timeInMiliseconds.hour));
    }
    processEnv_1.default.previousAppLaunchTime = this.config.launchTime;
    }

    Could you please let me know, what should I do?

    Thank in advance

  9. Hello Jose! I wanted to ask you if this works for Terminal servers? We want to disable the startup of teams for ALL users. Not sure if this method would work in this situation?
    Thank you!

    • Jose Espitia

      Hi Jimmy,

      I don’t see why it wouldn’t work. You’re modifying the source code of the application to disable automatic startup so it should work on any system.

Leave a Reply