- New Group Policy settings in Windows 11 23H2 - Mon, Nov 20 2023
- Windows Server 2025 will support SMB over QUIC in all editions - Fri, Nov 17 2023
- Switch between Windows Terminal and the legacy console - Thu, Nov 16 2023
Unlike the traditional console host, Windows Terminal runs the various command lines in tabs, with each shell configured through its own profile.
A profile's settings also include the option to run the respective shell with elevated privileges. However, by default, Windows Terminal opens all predefined profiles in the context of the currently logged-in account.
Create an administrative profile
To configure a new shell for administrative purposes, you can use the function to duplicate existing profiles. To do so, open the settings and click Add a new profile.
In the following dialog box, select an existing profile that you want to copy, and execute the Duplicate command. Now the settings of this new profile open, and you can change its name and activate the Run this profile as Administrator option.
After being saved, this new profile appears immediately on the dropdown list and can be started directly. As expected, the following authentication expects you to enter the credentials of an administrative account.
Separate windows for admin shells
After you have successfully logged in, the command line does not open in a new tab but in a separate window. This is not entirely surprising, because the program in question is started as a child process of the terminal.
However, if you open another instance of the administrative shell, it does not appear as a tab in the existing admin terminal, but again in a separate window.
Run all shells as admin
If you want to use Windows Terminal only for administrative purposes, you can activate the Run this profile as Administrator option in the settings under Profiles > Defaults. This saves you the effort of launching the terminal as an administrator. Since the icon in the taskbar does not offer this option, you would have to use the search function as a workaround.
Another quirk of Windows Terminal is that it opens all shells with elevated privileges at the next startup if you have selected the admin option for the default profile. Usually, this is Windows PowerShell. You will then no longer be able to access the original user's settings to undo this change (other than by editing the JSON file).
Error when opening in an admin context
Windows Terminal is a Store app, and as such, requires installation for each user. Depending on how the terminal was installed on your machine, running it as an administrator may fail if it doesn't exist for the account in question.
If you download the program from the store, the store app sets up the Windows terminal for all users. If, on the other hand, you install it under a standard account via sideloading of the MSIX bundle, then it is missing in the profile of the administrative account and, accordingly, causes an error message if you try to start a profile with elevated rights.
In this case, the additional installation of Windows Terminal under the privileged user usually helps. However, with some previews of Windows 11, running a profile as admin may fail even then.
Conclusion
Executing command lines in tabs of a single terminal window is convenient, but it makes launching shells with elevated privileges more complicated. Windows Terminal provides a corresponding option for each individual profile or for all shells.
If you decide to configure individual profiles for elevating permissions, they always open a separate window, which actually contradicts the concept of the application.
Subscribe to 4sysops newsletter!
The questionable decision to implement Windows Terminal as a Store app has also proven to be an obstacle. Depending on how the tool was installed, the invocation as admin may fail.
Great post as usual. Thank you for sharing the useful trick Mr. Wolfgang.
good job,thanks!
Hi, I was playing with the terminal and got stuck in the admin mode that you mentioned in one paragraph. How can I disabled the terminal to open always as admin using the JSON?