PowerShell Studio 2017: Service Release v5.4.142

Today we released a new service build of PowerShell Studio 2017 (v5.4.142).

In this service build we introduced new packager engines, new project features and made improvements to PowerShell Studio’s PrimalSense.

 

New Features

New Packager Engines

PowerShell Studio now includes three new packager engines that add more diversity to your existing scripts:

Windows Application Displays the script’s output in a Windows UI.
Windows Service Runs your script as a Windows service.
Windows AppTray Displays a tray icon while the script runs.

 

Refer to the following articles for more details on the new engines:

https://www.sapien.com/blog/2017/06/14/new-script-engines-for-windows-powershell/

https://www.sapien.com/blog/2017/07/10/creating-a-system-tray-application-with-powershell/

https://www.sapien.com/blog/2017/07/12/write-a-windows-service-in-powershell/

 

Projects – Synchronizing Files and Folders

We added two new project properties that will allow you to synchronize your project files and folders when the project is loaded. The new properties are located in the Synchronization group of the project properties. To edit the properties, select the project node in the Projects panel, then use the Properties pane to modify the project properties.

image

Synchronized

When enabled, this setting synchronizes the project files and folders. When the project is loaded, PowerShell Studio will automatically add new files and remove any missing files.

Dynamic Project Sync

File Filter

This file filter determines which files to search for when synchronizing the project files. Edit this property to customize the files that are included in the synchronization.

File Filter Formatting:

*.extension1;*.extenion2

Each extension filter needs to be separated by a semi-colon. For example, you can include images by appending the following filters:

*.jpg; *.png;

The default filter includes all PowerShell file extensions.

 

Project Snippets

PowerShell Studio now allows users to include project specific snippets. A project snippet folder will appear in the Snippet pane whenever you open a project.

Project Snippets

Project snippets take precedence over user and preset snippets.

Adding Project Snippets

To add a snippet to the project, simply create or copy the snippet to the project’s directory and PowerShell Studio will automatically display it in the Snippets pane when you open the project.

Note: You do not need to add the snippet to the project itself using the Project pane.

 

Copying Project Snippets

You can copy snippets to and from the project by simply dragging the snippet within the Snippets panel.

Drag & Drop Snippets

 

Improved PrimalSense for Dynamic Objects and Properties

We made some improvements to PowerShell Studio’s PrimalSense in this service release. PowerShell Studio will now be able to provide PrimalSense for dynamic objects and properties, such as custom PSObject with note properties.

$writer = [pscustomobject]@{ Name = 'David'; Last = 'Corrales' }

 

Why didn’t it do this before?

For two reasons:

  1. PowerShell Studio resets the PowerShell runspace on every execution.
  2. Because the runspace is hosted in a separate process, the editor was not able to provide PrimalSense for custom objects.

Thankfully we were able to address this problem in by using the stored session state information. Now let’s look at how you can use a session state to provide PrimalSense for variables.

 

How to store the session state for PrimalSense

1. Set a breakpoint in your script. It is important to choose the right location, because it determines the state of the session variables at that given point.

2. Start the debugger (F5). When the debugger hits a breakpoint, it will store the variable session state and display them in the Variables pane:

Breakpoint Variables Pane

Notice that the note properties are displayed in the Variables pane:

NoteProperties Variables Panel

3. Exit the debugger. PowerShell Studio will use the session state of the last break in order to provide PrimalSense for variables:

PrimalSense

As you can see, the note properties now appear in the PrimalSense list.

 

Clearing the Session State

If you wish to revert the PrimalSense session state, you can do this by using the Clear Session Variables command in the Variables pane’s context menu:

Variable Pane - Clear Session Variables

Alternatively, you can use the editor’s context menu:

Clear Session Variables

Clear Session Variables command is only enabled when the debugger has stopped.

 

We hope these new features improve your overall experience with PowerShell Studio. Please continue providing your feedback. Many of the new features included in the service builds are suggestions from users like you. Therefore, if you have any suggestions or feature requests, please share them with us on our Wish List and Feature Requests forum.