*from GitHub: Windows Terminal Issue 691, GitHub: gerardog/gsudo

Currently, Windows Terminal does not support running individual tabs as Administrator.
There is an elegant workaround employing a third-party application, gsudo.

  1. Start PowerShell as Administrator.

  2. Run:
     choco install gsudo -y 
    

    Note: you don’t need chocolatey; refer to the gsudo source.

  3. Open Windows Terminal -> Settings -> Add new

  4. Under Command line add this:
     pwsh.exe -Command "gsudo pwsh"
    

    Note: pwsh is for PowerShell 7 (if you have it). This works equally well for the default PowerShell: just replace pwsh with powershell.

  5. Change the tab icon to distinguish it from the non-elevated version.
    Here’s a red one.