New-AdminTerminal.ps1


Description

New-AdminTerminal launches Windows Terminal elevated as an administrator, targeting the PowerShell profile (-p pwsh). If the user is already running an elevated window, Windows prompts accordingly. Because the function simply wraps Start-Process with -Verb runas, it inherits the standard UAC prompt behaviour.

Usage examples

New-AdminTerminal

Run this from a non-elevated console to quickly open an admin terminal without navigating the Start menu.


Script

function New-AdminTerminal {
    <#
        .Synopsis
        Starts an Elevated Microsoft Terminal.

        .Description
        Opens a new Microsoft Terminal Elevated as Administrator. If the user is already running an elevated
        Microsoft Terminal, a message is displayed in the console session.

        .Example
        New-AdminShell

        #>

        Start-Process "wt.exe" -ArgumentList "-p pwsh" -Verb runas -PassThru
}

Back to Top


Download

Please feel free to copy parts of the script or if you would like to download the entire script, simple click the download button. You can download the complete repository in a zip file by clicking the Download link in the menu bar on the left hand side of the page.


Report Issues

You can report an issue or contribute to this site on GitHub. Simply click the button below and add any relevant notes. I will attempt to respond to all issues as soon as possible.

Issue


Back to Top