Experimental features

PowerShell core has recently. v6.2, had the concept of experimental features added.  An experimental feature is new or changed functionality that may be a breaking change or about which the PowerShell team want feedback before finalising the code.

My PowerShell v6.2.2 instance has the following experimental features


of which I’ve enabled PSCommandNotFoundSuggestion and PSTempDrive. Experimental features are disbaled by default in PowerShell v6.2

My PowerShell v7 preview 3 instance has the following experimental features


of which PSForEachObjectParallel and PSCommandNotFoundSuggestion

PSUseAbbreviationExpansion and PSTempDrive and now full features in PowerShell v7

If don’t have any PowerShell v6.2 experimental features enabled OR don’t have v6.2 installed and then install PowerShell v7 preview 3, or later, all experimental features will be enabled by default. If you’ve enabled any experimental features in PowerShell v6.2 then PowerShell v7 respects the settings and doesn’t enable all experimental features.

You can view the settings controlling experimental features (among other things) at

Get-Content –Path $home\Documents\PowerShell\powershell.config.json

The single settings file is used for PowerShell v6.2 and PowerShell v7 previews

Posted in PowerShell 7, PowerShell v6 | Leave a comment

PowerShell v7 preview 3

PowerShell v7 preview 3 is now available from https://github.com/PowerShell/PowerShell/releases

Breaking changes seem to be confined to non-Windows platforms with the removal of the kill alias on Stop-Process and support for pwsh as a login shell

The big new item is the –parallel parameter on Foreach-Object – more on this later.

In this preview version and future preview versions all experimental features will be enabled going forward

Posted in PowerShell 7 | Leave a comment

Out-GridView is back

Out-GridView is finally back in PowerShell core – https://devblogs.microsoft.com/powershell/out-gridview-returns/.

The project is hosted on github – https://github.com/powershell/GraphicalTools

Install the module from the gallery –

PS> Install-Module -Name Microsoft.PowerShell.GraphicalTools

Currently, Out-GridView is the only command in the module though adding Show-Command and Show-Object are planned.

The module works cross-platform not just Windows.

You need PowerShell v6.2 or later to build or presumably run the module.

Posted in PowerShell 7, PowerShell v6 | 1 Comment

PowerShell v2

Just seen a question about PowerShell v2. PowerShell v2 was a huge step forward when it appeared in October 2009 as part of Windows 7 / Server 2008 R2

Windows 7 support finishes 14 January 2020

Windows Server 2008 R2 support finishes 14 January 2020

That’s less than 6 months.

PowerShell v2 isn’t mentioned in the Microsoft documentation which starts at PowerShell v3

If you’re still using PowerShell v2 its beyond time to move to a later version.

Posted in PowerShell V2 | 1 Comment

Test if a transcript is running

PowerShell has the ability to create a transcript of the commands you run at the console and the results displayed in the console. But how can you test if a transcript is running?

It used to be that you could only have a single transcript running but Windows PowerShell v5.1 and PowerShell v6.x and later allow multiple transcripts to be running in the same session.

Only way I can think of testing if transcript has been started is to use

Get-History | where CommandLine -like ‘Start-Transcript*’

that doesn’t tell if its still running for which you need

Get-History | where CommandLine -like ‘Stop-Transcript*’

PS> (Get-History | where CommandLine -like ‘Start-Transcript*’).Count –  (Get-History | where CommandLine -like ‘Stop-Transcript*’).Count

should give a result of zero if no transcripts are running. A positive result indicates transcripts are running. A negative result indicates problems.

The test can be wrapped in a function

function test-runningtranscript {
     $starts = (Get-History | Where-Object CommandLine -like ‘Start-Transcript*’).Count
     $stops =  (Get-History | Where-Object CommandLine -like ‘Stop-Transcript*’).Count

    $trans = $starts – $stops

    switch ($trans){
         0           {$false}
         {$_ -gt 0}  {$true}
         {$_ -lt 0}  {Throw “Error!!!  Can’t have negative transcripts”}

You’ll get True return if there is a transcript running and False if there isn’t.

Posted in Powershell | 2 Comments

Identifying the host

Identifying the host in which your PowerShell code is running could be important. For instance you might not want to run some code that takes a long time to complete in VSCode – you may prefer to ensure it runs in the console as it consumes fewer resources.

You can identify the host – most of the time – using $host

For the PowerShell console – Windows PowerShell or PowerShell Core

PS> $host.Name

For ISE – Windows PowerShell

PS> $host.Name
Windows PowerShell ISE Host

For VScode – Windows PowerShell or PowerShell Core

PS> $host.Name
Visual Studio Code Host

For the new Windows Terminal – Windows PowerShell or PowerShell Core

PS> $host.Name

If you need to differentiate between the traditional PowerShell console and the new Windows terminal you’ll find that the Windows terminal adds an environmental variable


which takes a value of the form –   407c1756-556e-4df2-97db-c159a616b237

Posted in Powershell | Leave a comment

PowerShell Day UK 2019

The PowerShell Day UK 2019 one day conference is on Saturday 28 September 2019 – https://psday.uk/

I’ll be speaking and willing to answer any PowerShell questions that I can during the breaks.

If you have any books of mine that you want signing – bring them along and I’ll be happy to oblige.

Posted in Powershell | Leave a comment