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.
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.
Run and Debug
The Run and Debug commands have been reorganized to two separate 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.
Sign Script Menu
We copied the Sign Script menu over from the Tools tab.
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.
Convert Menu
The new Convert menu contains commands that transform your script in one way or another.
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 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:
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.
You can enable the Scope Highlighting feature from Ribbon > Home > Edit:
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:
Process Tracker
We updated the process tracker control set, to allow you to redirect the output of external processes.
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. |
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:
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:
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.
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.
Build Messages – Tools Output
Project and form build messages are now displayed in the Tools Output Panel.
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.
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:
Database Browser – Field Types
The Database browser (Object Browser panel) will now display the 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:
Select the Manifest file filter:
Then select the desired file:
The MSI Builder will than use the version directly from the manifest:
Warning Messages
The packager (PSBuild) now displays warning messages in certain instances:
- If the script has a #requires version higher than the packaging engine target.
- If the script has a #requires statement that specifies PowerShell Core.
- If you are using a switch statement in the script’s parameter block.
Refer to the following article: https://www.sapien.com/blog/2015/11/30/passing-parameters-to-a-script-in-an-executable-file/ - If the script contains #requires -RunAsAdministrator and the a elevation manifest is not selected.
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__
Requires Statement PrimalSense
PowerShell Studio will now provide PrimalSense for requires statement parameters and 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.
Thanks a lot for this service-release!,
it has many useful and powerful features 🙂
It’s just a pity that some of the little things are still missing, which almost every usual Texteditor like Notepad++ offers (especially Ctrl-D to duplicate Text or Lines and auto highlight selected Text)
Agree with Tom… as great as these updates are, you guys really need to get multi-select working. Anytime I need to do a lot of text replacements I end up copying everything to SublimeText, making edits there, then coming back to PS Studio to check the changes.