Problems With Startup Actions When Opening Multiple Tabs as Admin #20071

Closed
opened 2026-01-31 07:02:32 +00:00 by claunia · 3 comments
Owner

Originally created by @ThioJoe on GitHub (Jun 10, 2023).

Windows Terminal version

1.18.1462.0

Windows build number

10.0.22621.1778

Other Software

No response

Steps to reproduce

  1. Have profiles called "Command Prompt" and "Powershell 7" in Terminal Preview, both with "Run this profile as administrator" enabled, and/or in the "Defaults" menu under Profiles, have "Run this profile as administrator" (which seems to enable the admin setting on both anyway). "Command Prompt" is set as the default profile in settings.

These are the profiles:

            {
                "elevate": true,
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "hidden": false,
                "name": "Command Prompt",
                "opacity": 80,
                "startingDirectory": null,
                "tabTitle": null,
                "useAcrylic": true
            },

and

            {
                "adjustIndistinguishableColors": "indexed",
                "backgroundImage": "E:/SomeDirectory/image.jpg",
                "backgroundImageOpacity": 0.5,
                "colorScheme": "Campbell Powershell",
                "elevate": true,
                "experimental.retroTerminalEffect": false,
                "font": 
                {
                    "face": "CaskaydiaCove NF"
                },
                "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
                "hidden": false,
                "historySize": 50000,
                "name": "PowerShell 7",
                "opacity": 80,
                "source": "Windows.Terminal.PowershellCore",
                "startingDirectory": null,
                "tabTitle": null,
                "useAcrylic": true
            },
  1. With Windows Terminal Preview, have the following startup actions line in the JSON file:
    "startupActions": "new-tab -p \"PowerShell 7\" ; new-tab -p \"Command Prompt\"",

  2. Run Terminal Preview

Expected Behavior

Until recently, the following would happen:

  1. A UAC prompt appears
  2. Accepting the prompt would open Terminal Preview with two tabs, first Powershell 7 and Command Prompt. When not running the profiles as administrator, that does still happen as expected.

Actual Behavior

One of two scenarios will occur, seemingly randomly as for which:

Scenario A - An Error Occurs and only one tab opens:
The UAC Prompt will appear, and after accepting it, it will open a Terminal Preview tab for either "Administrator: Powershell 7" or "Adminsitrator: Command Prompt", but no second tab will open with the other, and instead I see the following error message:
The group or resource is not in the correct state to perform the requested operation.
image

When the error happens, which of the tabs opens seems to be random. After testing I can confirm that regardless of the order of the tabs set in the startup actions, either Command Prompt or Powershell may open. It seems to be random.

Also when the error occurs, it seems to always pop up before the UAC prompt does.

Scenario B - Both profiles open, but with two separate UAC prompts and separate windows:
Alternatively, seemingly half the time, I will get two UAC prompts back to back that will open each profile in their own entire separate window, instead of one UAC prompt opening both as tabs simultaneously in one window as expected. As soon as one UAC prompt is accepted, the other appears with no delay, so there is no time to see any window open before the second UAC prompt.

As a test, I rejected the second UAC prompt, and found that the first UAC prompt will open the window of the first profile in the "startup actions" line. I switched the order in the startup actions line and this stayed the case, regardless of the "default profile".

Originally created by @ThioJoe on GitHub (Jun 10, 2023). ### Windows Terminal version 1.18.1462.0 ### Windows build number 10.0.22621.1778 ### Other Software _No response_ ### Steps to reproduce 1. Have profiles called "Command Prompt" and "Powershell 7" in Terminal Preview, both with "Run this profile as administrator" enabled, and/or in the "Defaults" menu under Profiles, have "Run this profile as administrator" (which seems to enable the admin setting on both anyway). "Command Prompt" is set as the default profile in settings. These are the profiles: ``` { "elevate": true, "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}", "hidden": false, "name": "Command Prompt", "opacity": 80, "startingDirectory": null, "tabTitle": null, "useAcrylic": true }, ``` and ``` { "adjustIndistinguishableColors": "indexed", "backgroundImage": "E:/SomeDirectory/image.jpg", "backgroundImageOpacity": 0.5, "colorScheme": "Campbell Powershell", "elevate": true, "experimental.retroTerminalEffect": false, "font": { "face": "CaskaydiaCove NF" }, "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}", "hidden": false, "historySize": 50000, "name": "PowerShell 7", "opacity": 80, "source": "Windows.Terminal.PowershellCore", "startingDirectory": null, "tabTitle": null, "useAcrylic": true }, ``` 3. With Windows Terminal Preview, have the following startup actions line in the JSON file: `"startupActions": "new-tab -p \"PowerShell 7\" ; new-tab -p \"Command Prompt\"",` 4. Run Terminal Preview ### Expected Behavior Until recently, the following would happen: 1. A UAC prompt appears 2. Accepting the prompt would open Terminal Preview with two tabs, first Powershell 7 and Command Prompt. When not running the profiles as administrator, that does still happen as expected. ### Actual Behavior One of two scenarios will occur, seemingly randomly as for which: **Scenario A - An Error Occurs and only one tab opens:** The UAC Prompt will appear, and after accepting it, it will open a Terminal Preview tab for _either_ "Administrator: Powershell 7" or "Adminsitrator: Command Prompt", but no second tab will open with the other, and instead I see the following error message: `The group or resource is not in the correct state to perform the requested operation.` <img width="398" alt="image" src="https://github.com/microsoft/terminal/assets/12518330/9a699242-7e04-4170-bf7b-1f23e514da8e"> When the error happens, which of the tabs opens seems to be random. After testing I can confirm that regardless of the order of the tabs set in the startup actions, either Command Prompt or Powershell may open. It seems to be random. Also when the error occurs, it seems to always pop up before the UAC prompt does. **Scenario B - Both profiles open, but with two separate UAC prompts and separate windows:** Alternatively, seemingly half the time, I will get two UAC prompts back to back that will open each profile in their own entire separate window, instead of one UAC prompt opening both as tabs simultaneously in one window as expected. As soon as one UAC prompt is accepted, the other appears with no delay, so there is no time to see any window open before the second UAC prompt. As a test, I rejected the second UAC prompt, and found that the first UAC prompt will open the window of the first profile in the "startup actions" line. I switched the order in the startup actions line and this stayed the case, regardless of the "default profile".
claunia added the Area-SettingsIssue-BugResolution-DuplicateProduct-Terminal labels 2026-01-31 07:02:32 +00:00
Author
Owner

@carlos-zamora commented on GitHub (Jun 14, 2023):

Thanks for filing! While the symptom is new, at its core, this is kinda the same thing as #14442. So we're going to mark this as a /dup of #14442, but keep this in mind with the fix.

@carlos-zamora commented on GitHub (Jun 14, 2023): Thanks for filing! While the symptom is new, at its core, this is kinda the same thing as #14442. So we're going to mark this as a /dup of #14442, but keep this in mind with the fix.
Author
Owner

@microsoft-github-policy-service[bot] commented on GitHub (Jun 14, 2023):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@microsoft-github-policy-service[bot] commented on GitHub (Jun 14, 2023): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Author
Owner

@ThioJoe commented on GitHub (Jun 15, 2023):

Ah ok, yea I hadn't noticed that other issue

@ThioJoe commented on GitHub (Jun 15, 2023): Ah ok, yea I hadn't noticed that other issue
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20071