PowerShell Studio: Working with PowerShell Core

A couple of months ago, Microsoft announced that PowerShell Core had reached the Generally Available (GA) and supported status. Subsequently, we released PowerShell Studio 2018 which features the ability to build, test, and execute PowerShell Core scripts. As PowerShell Core evolves, SAPIEN Technologies is committed to expand and support PowerShell Core with subsequent builds of our products.

In this article, we demonstrate how to setup and use PowerShell Core in PowerShell Studio 2018.

Setting up PowerShell Core in PowerShell Studio

If PowerShell Core Version 6.0.1 is already installed in the system, PowerShell Studio 2018 has it detected and ready to use in the Console panel:

Remember, PowerShell Core will keep evolving. Whenever you upgrade to the next version of PowerShell Core, you will need to manually update the path to the console shell executable (“pwsh.exe“) in PowerShell Studio.

For example, the initial PowerShell Core default path in PowerShell Studio is:
C:\Program Files\PowerShell\6.0.1

But, at the time of this blog post, the latest PowerShell Core version is “6.1.0-Preview.1”. You would need to change the default path to:
“C:\Program Files\PowerShell\6.1.0-Preview.1”

Follow these steps to change the PowerShell Core path in PowerShell Studio:
1. From the Home tab on the ribbon, select Options.
2. Select Console, and look in the Consoles section.

In the Consoles section, the path can be changed, or you can add more console shells to the existing list:

To apply the changes, you will need to save the changes and restart PowerShell Studio.

Working with PowerShell Core in PowerShell Studio

Follow these steps to execute PowerShell Core scripts from the PowerShell Studio Console panel:
1. Select PowerShell Core 64bit from the Console panel drop-down list.
2. Highlight the code to be executed.
3. Press F8 to Run Selection in Console, or right-click and select Run Selection in Console.

Notice that PowerShell Studio will not execute the *ps1 file for PowerShell Core scripts. If you press the Run button it will assume Windows PowerShell and not PowerShell Core.

The ability to Run and Debug the PowerShell Core script file will be implemented in a future release.

Related Links

Feedback

As always, we love to hear from you! Submit your feedback and suggestions in our Feedback forum.

Submit PowerShell Core feedback and bugs in Github.

 

Max Trinidad is a Technology Evangelist at SAPIEN Technologies Inc., and a Microsoft PowerShell MVP. You can reach him at maxt@sapien.com