Windows Terminal: Run PowerShell as Administrator
*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.
-
Start PowerShell as Administrator.
- Run:
choco install gsudo -yNote: you don’t need chocolatey; refer to the gsudo source.
-
Open Windows Terminal ->
Settings->Add new - Under
Command lineadd this:pwsh.exe -Command "gsudo pwsh"Note:
pwshis for PowerShell 7 (if you have it). This works equally well for the default PowerShell: just replacepwshwithpowershell. - Change the tab icon to distinguish it from the non-elevated version.
Here’s a red one.