Skip to content

Instantly share code, notes, and snippets.

@IAmStoxe
Created November 6, 2024 18:35
Show Gist options
  • Save IAmStoxe/1e44fb03975ce4cdbe4471f628bc1f20 to your computer and use it in GitHub Desktop.
Save IAmStoxe/1e44fb03975ce4cdbe4471f628bc1f20 to your computer and use it in GitHub Desktop.
This configuration allows you to launch a Windows Terminal session under your DA account directly from your standard account, giving you elevated access when needed without switching users entirely.

Step-by-Step Guide for Configuring an Elevated DA Account Profile in Windows Terminal

  1. Open Windows Terminal Settings:

    • Open Windows Terminal.
    • Click on the dropdown arrow and select Settings.
  2. Add a New Profile:

    • In the Settings panel, navigate to Profiles and click on Add a new profile.
    • Choose PowerShell (or Command Prompt, depending on your preference) as the base profile.
  3. Configure the Profile for DA Elevation:

    • Set up the command line for the profile to use the runas command to launch PowerShell as your DA account, specifying your DA credentials directly.

    • Here’s an example configuration for the command line:

      runas /smartcard /user:YOUR_DOMAIN\YOUR_DA_ACCOUNT "powershell.exe -NoExit -Command Start-Process powershell -ArgumentList '-NoProfile -ExecutionPolicy Bypass' -Verb RunAs"
      
      • Replace YOUR_DOMAIN\YOUR_DA_ACCOUNT with your actual domain and DA username.
  4. Customize the Profile Settings:

    • Name: Give this profile a clear name, such as "DA PowerShell (Elevated)", so you can easily identify it in the dropdown.
    • Icon: (Optional) Set a custom icon to distinguish this profile.
    • Starting Directory: Set a starting directory if you want a specific directory for the DA session.

    Your profile configuration in the JSON file should look like this:

    {
        "guid": "{INSERT-UNIQUE-GUID-HERE}",
        "name": "DA PowerShell (Elevated)",
        "commandline": "runas /smartcard /user:YOUR_DOMAIN\\YOUR_DA_ACCOUNT \"powershell.exe -NoExit -Command Start-Process powershell -ArgumentList '-NoProfile -ExecutionPolicy Bypass' -Verb RunAs\"",
        "icon": "C:\\Path\\To\\Icon.ico",
        "startingDirectory": "C:\\Path\\To\\Starting\\Directory",
        "description": "Opens PowerShell as DA with elevated privileges",
        "hidden": false
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment