4

I have Windows 11 Pro (21H2). I have Windows Terminal icon in the Taskbar. I always have to right-click on it, and click Run-As-Administrator. I'd rather have it run as Administrator by default. I can create a shortcut on my Desktop, and set it to run as administrator by default. But I want the Windows Taskbar icon to do that.

I have already changed the executable (WindowsTerminal.exe & wt.exe) to supposedly Run as Administrator, for all users. I've also dabbled with Troubleshooting Compatibility. Nothing makes the Windows Terminal icon ON THE TASKBAR open Windows Terminal in admin mode.

(It seems like you can't drag-and-drop shortcuts to the Taskbar anymore with Windows 11. So that won't work either.)

2 Answers2

0

There may be an easier way (or perhaps not), but here is at least a method that works on Windows 11. It reads as a little convoluted, but that's mainly because I want to provide instructions that are as "failsafe" as possible:

  • Create a script, let's say %userprofile%\Documents\Scripts\wt_as_admin.ps with the following:

    Start-Process wt -Verb RunAs
    
  • Test it by right-clicking it in File Explorer and selecting Run with PowerShell. It should bring up the UAC and run Windows Terminal as admin.

  • In File Explorer, navigate to %userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs

  • New -> Shortcut

    • For Location, just type powershell.exe
    • Click Next
    • For the Name, call it "Windows Terminal Admin" (or whatever you want)
    • Click Finish
  • Right-click the shortcut you just created and select Properties

    • You'll notice that Windows has expanded powershell.exe to its full path. Add to that %userprofile\Documents\Scripts\wt_as_admin.ps (or wherever your script is).
    • Choose a suitable icon. You can find the Windows Terminal .ico file in the Github repo here.
  • Bring up the Windows Start menu

  • Search for "Windows Terminal Admin" (or whatever you called the shortcut)

  • Right-click on it and Pin to Taskbar

NotTheDr01ds
  • 21,923
0

In the Start menu or Run dialog on Win+R you can press Ctrl+Shift+Enter to start any app elevated.

Inside Windows Terminal you can use gsudo to start Powershell or other shells elevated, just prefix the start command with gsudo.exe.

gavenkoa
  • 1,996