SAPIEN Tools – Working with PowerShell Core

As PowerShell Core continues to evolve, SAPIEN Technologies continues to hone our two main editors—PrimalScript and PowerShell Studio—enhancing them to accommodate PowerShell Core.

PrimalScript Version 7.4.115

PrimalScript—our industry-leading Universal Script Environment (USE)—can handle multi-language coding, including Windows PowerShell. We have integrated PowerShell Core support in PrimalScript, allowing you to start scripting and testing the latest releases of either GA (Generally Available) or Preview.

If you work with the GA and the Preview editions of PowerShell Core, PrimalScript will automatically detect both versions and make them available when running scripts (Home > Platform > PowerShell Core).

During installation, PrimalScript will also recreate the Console Window entries for any PowerShell Core versions that are already installed.

When you click in the Console Window panel to view the list of all the PowerShell versions available, you will see the existing PowerShell Core versions installed in your system.

To execute the whole script, select the PowerShell Core button. If you have multiple versions, select one of the versions available and then select Run Script. The results will be displayed in the Output panel.

To execute the script in the PowerShell Core console:

  1. From the Console Window pull-down list, select the desired PowerShell Core version.
  2. On the Home ribbon > in the Build and Run section > select Run Script > then select Run in Shell. This will execute the script in the active console in the Console Window panel.

The result will be displayed in the selected console.

Note: Remember to first select the PowerShell console from the Console panel drop-down list.

Executing a highlighted block of code can be accomplished in one of two ways:

  • On the Home ribbon > in the Build and Run section > select Run Script > then select Run Selection in Shell.
  • Right-click on the highlighted code > then select Execute Selection in PowerShell.

The code will be executed in the active Console Window.

PowerShell Studio Version 5.5.154

PowerShell Studio is the industry-leading PowerShell RAD (Rapid Application Development) tool. This is the Visual Studio for PowerShell for any level of work—perfectly suited for the enterprise—and an essential component of your tool chest.

PowerShell Studio allows you to work with PowerShell Core, and it will find and recognize which version of PowerShell Core is installed on your system. If both the GA (Generally Available) and the Preview are installed, then it will create the link to their executables (Home ribbon > Windows section > Options > Console tab).

Highlight a block of code then select Run Selection in Console to execute the code on the active shell found in the Console panel.

To execute the whole PowerShell Core script, select the Run button.

Note: Remember to select the desired Platform.

  

PowerShell Core is built on .NET Core which does not support Windows Forms. But, if you think outside-of-the-box, you can be creative with PowerShell Studio and overcome this limitation.

Summary

To execute PowerShell Core scripts from either PrimalScript or PowerShell Studio:

  1. Setup the PowerShell Core platform.
  2. Select the appropriate PowerShell Core console from the console drop-down list.
  3. Execute the script using either Run Selection in Console or Run in Console.

What’s Coming!

We have exciting plans for both PrimalScript and PowerShell Studio, including features and improvements based on your feedback and suggestions. We will also continue to enhance both programs as Microsoft updates and evolves their PowerShell Core products and SDK’s.

A note about console shell updates: Both PrimalScript and PowerShell Studio will detect and update the PowerShell Core console when a newer version is installed. To manually update:

  • PrimalScript: File > Options > Command Window tab > Rescan
  • PowerShell Studio: Home ribbon > Windows section > Options > Console tab > Reset

 

Stay tuned for more product improvements in the upcoming service releases.

For more information

Related Articles

Feedback

As always, if you have any ideas, comments, or feedback, please visit our feedback forum and reference this post.

 

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