Adding Test Hosts to PowerShell ISE

by Sep 10, 2015

To quickly open new test hosts inside the PowerShell ISE that ships with PowerShell 3.0 and better, here is a small helper function:

#requires -Version 3


function New-PSHost
{
    param
    (
        [Parameter(Mandatory = $true)]
        $Name
    )

    $newTab = $psise.PowerShellTabs.Add()
    $newTab.DisplayName = $Name
}

When you run this function and then enter New-PSHost, you get prompted for a name. Enter a name for your new testing host, and press ENTER. PowerShell ISE will then open a new PowerShell host and display the host in its own new PowerShell tab, labelled with the name you chose.

Twitter This Tip! ReTweet this Tip!