Different profiles with Windows Terminal

Welcome Forums General PowerShell Q&A Different profiles with Windows Terminal

Viewing 3 reply threads
  • Author
    Posts
    • #210522
      Participant
      Topics: 1
      Replies: 1
      Points: 36
      Rank: Member

      I feel that there should be a way to do this but I am drawing blanks at the moment and could really use some help. I am trying to integrate the new Windows Terminal into my daily personal routines and so far am really liking it. I watched one of the Channel 9 videos that really showed off some of the key features in a nice way:

      https://channel9.msdn.com/Shows/Tabs-vs-Spaces/Windows-Terminal-the-secret-to-command-line-happiness?term=windows%20terminal&lang-en=true

      This got me thinking; it would be nice if I could setup different PowerShell profiles in the Windows Terminal to support different things; one for AD administration, another for SQL Server DBA work, maybe one with standard variable names set for a test environment vs another with those variables set for a production environment.

      While this seems easy enough in theory and I can setup different Terminal profiles they all seem to be calling the same Windows PowerShell shells in the background, so I am just getting the same profile loaded regardless of the Windows Terminal profile. I was hoping for a way to be able to load different Windows PowerShell profiles upon getting called. Is this possible? Am I missing something very basic or is what I am asking for just not possible without calling an entirely separate environment (like PoSh 5 vs PoSh 7, vs Az Shell)?

    • #210531
      Participant
      Topics: 4
      Replies: 2247
      Points: 5,484
      Helping Hand
      Rank: Community MVP

      As I understood it you can have one profile for each individual environment and not multiple profiles for each environment.

    • #211131
      Participant
      Topics: 1
      Replies: 1
      Points: 36
      Rank: Member

      I figured it out. It did turn out to be a lot easier than I thought. Basically there is a “commandline” option in the profiles.json file. I can just call that with “-noexit” and “-file” pointing to a file with specific parameters for that PowerShell session.

      Olaf, yes you can have multiple profiles pointing to the same consoles. The only caveat I realized is that on the additional profiles you cannot have the “source” option specified; I think that is reserved for dynamic profiles.

      I would love to show screenshots of examples, but I cannot figure out how to post images in this forum.

      • This reply was modified 2 months, 2 weeks ago by joieandrew05.
    • #211185
      Participant
      Topics: 4
      Replies: 2247
      Points: 5,484
      Helping Hand
      Rank: Community MVP

      Cool. Thanks for sharing your findings.

      I would love to show screenshots of examples, but I cannot figure out how to post images in this forum.

      Screenshots of code are usually pointless because you cannot copy the code. 😉 A part of your settings file or a sample settings file formatted as code or shared with a Github gist would by cool I think.

Viewing 3 reply threads
  • You must be logged in to reply to this topic.