Renaming Tabs in the ISE

Renaming Tabs in the ISE

  • Comments 4

When you have multiple PowerShell tabs open in the ISE, it may be handy to rename them, so you can tell which is which.  This is especially useful when using Remoting with Enter-PSSession.  The problem when using Enter-PSSession is that you have no access to the root ISE object ($psise) when remoting, so you should use another (local) tab and enter the following:

   $psise.PowerShellTabs[0].DisplayName = 'myRemoteMachine'

Needless to say, if you want to rename the second tab, you'd use PowerShellTabs[1] ... and so on

To rename the current PowerShell tab, enter:

   $psise.CurrentPowerShellTab.DisplayName = 'PowerShellRocks'

ref@

Refaat Issa [MSFT]

Leave a Comment
  • Please add 2 and 3 and type the answer here:
  • Post
  • You can add a new tab with $psISE.PowerShellTabs.Add(). Is there any way to open a tab with admin rights?

  • @Eric,

    You've probably already sorted this but anyone else needing an alternate context can open ISE with the "runas" command and change the user context that way. Works like a charm in the domain environment.

  • Is there any way to create an "ISE profile" that will automatically create/name tabs each time you open the program?

  • @Eric G

    You want to first create a new profile that will apply only to ISE. Create the below file:

       "C:\Users\$env:UserName\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1"

    Next you want to put the following code in that script:

       Function New-PowershellISETab {

           Param (

               [String[]]$Name

           )

           ForEach ($N in $Name){

              $PSISE.PowerShellTabs.Add() | Out-Null

              $PSISE.PowerShellTabs[-1].DisplayName = $N

           }

       }

       New-PowersheISETab -Name "My New Tab","My Other New Tab"

    Obviously, you want to edit that last line to reflect the tabs you want opened automatically. The function will also be available to you whenever you run ISE so you can create (and name) new tabs on the fly. You will want to ensure that you have script execution set appropriately so that this script actually executes.

Page 1 of 1 (4 items)