Home Blog CompatAware – Safely Develop Against Different PowerShell Versions

CompatAware – Safely Develop Against Different PowerShell Versions

Today is my birthday, and I made myself a little present: ISESteroids now has a new feature called “CompatAware”. It helps you safely develop against different PowerShell versions. This will be included in the next release, and today I’d like to share with you how this works.

Safely Targeting a PowerShell Version

The system you use to create PowerShell code is not necessarily running the same PowerShell version as the systems that your scripts will run on later.

In fact, as a PowerShell enthusiast, you probably update your own systems to the best and latest PowerShell version you can get. Customers and corporate environments often take longer to update, and may be still running PowerShell 2 or 3.

So when you create scripts, you face the challenge to keep an eye on the PowerShell features you use, making sure you stick to the desired target version.

Checks backwards compatibility

Incompatible cmdlets and parameters are marked

In the upcoming release, there is a new menu “Compatibility” inside the “Level” menu: simply set the desired PowerShell target version.

Once you do this, ISESteroids automatically marks any cmdlet and/or any parameter that is not compatible to the desired target version. You will see a yellow squiggle, and when you hover over it, you see the PowerShell version that implemented this feature.

So the compatibility check is a real-time experience. You get warned immediately, while you code, rather than having to run checks manually.

The reasoning is that ISESteroids should help you keep on track. You don’t want to invest hours to create a script, just to discover at the end that you used features not available on the target PowerShell platform.

Tooltip Support for Squiggles

Tooltips now also work for any of the other squiggles. So the learning experience has been further improved. If you use double-quoted strings, for example, without expanding any variables inside, you see the blue squiggle.

In the new release, when you hover over the squiggle, you immediately get a tooltip explaining just why you should reconsider this statement.

Hover over squiggle to get tooltip support

Hover over squiggle to get tooltip support

To fix the issue, in the new release all you need to do is click the light bulb. The code is then automatically fixed for you.

When Available?

I expect the new release to be available for download by next week. Don’t nail me on this, today I may be out celebrating my birthday, and it could get out of hand.