We released a new service build of PowerShell Studio 2019 (v5.6.159). This service build is included as part of the regular update cycle for our subscribers.
New Features
This service release introduces new settings for the service installer, a new return variable for DataGridView controls in projects, and also adds a new cache command.
New Service Installer Settings
You now have more control over your service installer’s behavior.
You can now specify which account the service will run under, and also control whether the service is stopped or started during installation. You can enable the service to interact with the desktop via the installer.
Note: The Service Settings tab will only appear when the Project Type is set to Windows Service.
New DataGridView Return Variable
This build introduces a new return variable for the DataGridView in projects, when invoking a psf form file:
$FormName_DataGridViewName_SelectedObjects
The SelectedObjects return variable will contain an array of the data bound objects pertaining to the selected rows / cells.
When you invoke the form in a project, PowerShell Studio will automatically generate the return variables.
In this example, we will output the contents of the variables.
1. Invoke the form with the DataGridView and select several cells or rows:
In this example, the grid is displaying WMI objects.
2. After the Grid form is closed, the script then displays the contents of the variables.
$GridTest_datagridviewResults
This variable returns the collection of selected cells. We use the Select-Object cmdlet to extract the cell values.
$GridText_datagridviewResults_SelectedObjects
This variable returns the data bound objects. In this case, it contains the WMI objects that each row was bound to.
Special Considerations
- If you use a DataTable to bind to the DataGridView, then it will contain DataRowView objects for the SelectedObjects variable.
- If you manually built the contents of the DataGridView, the SelectedObjects variable will contain null values.
Updated Cache Commands
We now have two cache related commands:
Rebuild Local Cache
This command rebuilds the cache, including any new modules installed.
If you modified the cache with Cache Editor, PowerShell Studio will now prompt you before rebuilding the cache:
Press Yes, to override the manual changes.
Press No, to cancel.
This safety check will help prevent accidentally undoing any manual changes made to the cache.
Reload Cache
This command will reload the cache without making any changes.
Use this command to reload the cache after making changes with the Cache Editor.
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.
Great to see!