PowerShell Studio 2018: Service Release v5.5.155

We released a new service build of PowerShell Studio 2018 (v5.5.155). This service build is included as part of the regular update cycle for our subscribers.

 

New Features

This service release introduces new features such as Scope Highlighting and updates PowerShell Studio’s ribbon to surface hidden features.

PowerShell Studio Update

 

Updated Ribbon

The most notable change with this build is the redesigned ribbon. We update the ribbon’s Home tab in order to surface hidden features and moved features from the Tools tabs over to the Home tab.

Updated Ribbon

 

Run and Debug

The Run and Debug commands have been reorganized to two separate groups:

Run Debug Groups

 

The Custom Tool menu was moved to the Run group to make it more accessible.

 

Edit

The biggest change involves the Edit group. New menus have been added to surface new and existing features, and some functionality has been relocated from the Tools tab.

Edit Group

 

Sign Script Menu

We copied the Sign Script menu over from the Tools tab.

Sign Menu

 

Use this menu to sign your scripts or remove an existing signature.

 

Analysis Menu

We added an Analysis menu that contains the commands located in the Analysis group of the Tools tab.

Analyze Menu

 

Convert Menu

The new Convert menu contains commands that transform your script in one way or another.

Convert Menu

 

Uppercase
Converts the current character or selection to uppercase.

Lowercase
Converts the current character or selection to lowercase.

Decimal
Converts the selected hexadecimal number to a decimal number.

Hexadecimal
Converts the selected decimal number to a hexadecimal number.

Rename
Renames the references of the selected object or command.

Splat Command
Splats the parameters of the command.

Expand Aliases
Expands all the aliases in the script.

Qualify Cmdlets
Renames the cmdlets in the script to use the fully qualified (ModuleName\CommandName) name.

Unqualify Cmdlets
Renames fully qualified cmdlets in the script to use their short name.

 

Find Replace Menu

The Find Replace button now contains a sub-menu:

Find Menu

 

Find in Files…
Copied over from the Tools tab. Search multiple files for specific text.

Find All References
Finds all the references of the object / command within the script or project.

 

New Button Group

There is a new group of buttons added the Edit group:

Edit Button Group

Assemblies
The assemblies command has been moved into this group. The assemblies dialog allows you to select external assemblies to be imported by the script and PowerShell Studio’s PrimalSense™.

Compare Files
Copied from the Tools tab.  Compare the script with another file.

Generate Comment-Based Help
Generates commend-based help for the selected command.

Scope Highlighting
This button toggles the new Scope Highlighting feature, which is covered below.

 

Scope Highlighting

When editing scripts, sometimes it is necessary to determine the scope of a script block. To determine this, previously you had the option to use the bracket highlighting to find the matching opening and closing bracket—but doing this requires you stop what you are doing and unnecessarily move away from the line you are editing. With the new Scope Highlighting feature you can visually determine which is the scope you are currently editing, without having to scroll or leave the line you are editing.

Scope Highlighting

 

You can enable the Scope Highlighting feature from Ribbon > Home > Edit:

Toggle Scope Highlighting

 

Since the option is surfaced on the ribbon, you easily enable or disable this feature when necessary.

 

Updated Control Sets

This build updates some existing control sets.

Button – Run Process and Button – Start Job

These control sets now use splatting in the button click events to make the script easier to read:

Control Set Splatting

 

Process Tracker

We updated the process tracker control set, to allow you to redirect the output of external processes.

 Process Tracker Button

 

The Add-ProcessTracker function has several new parameters to facilitate output redirection and gives more control over whether or not the process is displayed.

A special thanks to James Vierra for demonstrating to a PowerShell Studio user how to redirect the output of a process in a GUI, which is the reason for this update.

 

New Parameters:
Parameter Description

RedirectOutputScript

The script block that handles output from the process.
Use $_.Data to access the output text.

RedirectErrorScript The script block that handles error output from the process.
Use $_.Data to access the output text.
NoNewWindow Start the new process in the current console window.
WindowStyle Specifies the state of the window that is used for the new process.
Valid values are Normal, Hidden, Minimized, and Maximized.
The default value is Normal.
WorkingDirectory Specifies the location of the executable file or document that runs in the process.
The default is the current directory.
RedirectInput Redirects the input of the process. If this switch is set, the function will return the process object.
Use the process object’s StandardInput property to access the input stream.
PassThru Returns the process that was started.
SyncObject The object used to marshal the process event handler calls that are issued.
You must pass a control to sync, otherwise it will produce an error when redirecting output.

 

Example – Redirecting Output

In this example, we show how to redirect the output of a process:

$paramAddProcessTracker = @{
	FilePath						  = 'ping.exe'
	Arguments						  = 'sapien.com'
	SyncObject						  = $buttonRunProcess
	RedirectOutputScript			  = {
		# Use $_.Data to access the output text
		$richtextboxOutput.AppendText($_.Data)
		$richtextboxOutput.AppendText("`r`n")
	}
	RedirectErrorScript					  = {
		if ($_.Data)
		{
			# Use $_.Data to access the output text		
			# Use red to display errors
			$colorOld = $richtextboxOutput.SelectionColor;
			$richtextboxOutput.SelectionColor = 'Red'
			$richtextboxOutput.AppendText($_.Data)
			$richtextboxOutput.AppendText("`r`n")
			$richtextboxOutput.SelectionColor = $colorOld
		}
	}
}
 
Add-ProcessTracker @paramAddProcessTracker

Output:

Redirect Output Example

 

Example – Redirecting Input

In this example, we show how to redirect the input of a process:

$paramAddProcessTracker = @{
	FilePath				  = 'powershell.exe'
	SyncObject				  = $buttonRunProcess
	RedirectOutputScript			  = {
		# Use $_.Data to access the output text
		$richtextbox1.AppendText($_.Data)
		$richtextbox1.AppendText("`r`n")
	}
	RedirectInput				  = $true
}
 
$process = Add-ProcessTracker @paramAddProcessTracker
 
#Write to the console
$process.StandardInput.WriteLine("Get-Process")

Output:

Redirect Input Example

 

New Form Template

TextBox – Redirect Process Output

This new GUI template uses the Process Tracker to redirect and display the output of an external process using a textbox. Any process error output is distinguished in red.

Redirect Template

 

Universal Version Control – Git Menu Update

The Git provider now has All variants to applicable commands. In addition, the Universal Version Control commands now support tooltips.

Git All Command

 

Build Messages – Tools Output

Project and form build messages are now displayed in the Tools Output Panel.

Tools Pane - Build Output

 

Moving the build messages to the Tools Output panel allows the Output panel to focus on script output.

 

New Snippet

There is a new snippet Get-ScriptName. The script inserts a function that returns the name of the script or package executable.

 

About Box – Copy Version Information

The About Box’s Copy Version Info button will now copy the application and OS information to the clipboard.

About Box - Copy Version Info

Use this feature to copy the relevant information for technical support on our forums:

 

Product:  PowerShell Studio 2018 (64 Bit)
Build:    v5.5.155
OS:       Windows 10 Pro (64 Bit)
Build:    v10.0.17134.0

 

PowerShell Browser – Module Versions

The PowerShell browser (Object Browser panel) will now display the version number of the cached modules:

PowerShell Browser Module Versions

 

Database Browser – Field Types

The Database browser (Object Browser panel) will now display the field types:

Database Browser - Field Types

 

Packager Updates

This build introduces new additions to the packager.

 

Version Information from Manifest

The MSI builder can now pull the version information directly from your module manifest.

Go to the MSI Settings and press the browse button next to the version field:

Version Browse Button

 

Select the Manifest file filter:

Select Manifest Filter

Then select the desired file:

MSI Setting Version from Manifest

 

The MSI Builder will than use the version directly from the manifest:

Version Output From PSBuild

 

Warning Messages

The packager (PSBuild) now displays warning messages in certain instances:

PSBuild Warnings

 

Macro Variables

The packager will expand the following text in a script when the executable is built:

__PRODUCTVERSION__
__FILEVERSION__
__PRODUCTDESCRIPTION__
__PRODUCTNAME__
__COMPANY__
__COPYRIGHT__
__FILE__
__DATE__
__TIME__
__TARGET__
__PROCESSOR__

 

Packager Micro Output

 

Requires Statement PrimalSense

PowerShell Studio will now provide PrimalSense for requires statement parameters and values:

Requires PrimalSense

Requires PrimalSense Values

 

Feedback

Please continue providing your feedback. Many of the new features included in the service builds are suggestions from users like you. Submit your suggestions or feature requests on the Wish List and Feature Requests forum or the new Feature Requests page.

You can view the complete service build log here.