Adding Powershell Cmdlets to Custom Tools Menu

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 7 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
HLAGAE
Posts: 2
Last visit: Wed Aug 29, 2018 12:00 am

Adding Powershell Cmdlets to Custom Tools Menu

Post by HLAGAE »

Hello

what is the best way to add powershell cmdlet calls to the custom tools menu? Currently I only see examples and blogposts how to add third party executables.

rgds

JT
DevinL
Posts: 1098
Last visit: Tue Jun 06, 2017 9:15 am

Re: Adding Powershell Cmdlets to Custom Tools Menu

Post by DevinL »

You can actually do the same thing as in the examples with the third party executables. You provide the path to the PowerShell executable followed by the cmdlet you wish to run for that tool. You end up adding a line that looks something like this:

5=Get-ChildItem;"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" Get-ChildItem C:\Users\DevinL\Desktop
DevinL
SAPIEN Technologies, Inc.
DevinL
Posts: 1098
Last visit: Tue Jun 06, 2017 9:15 am

Re: Adding Powershell Cmdlets to Custom Tools Menu

Post by DevinL »

A couple alternatives would be to create a script that runs whichever cmdlets you want to run and call that instead of the cmdlet directly. This way you wouldn't have to go into the CustomMenu.inf file every time you want to change what the tool does, you just modify that one script and the CustomMenu would have an extra line like so:

6=Get-ChildItem;"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" C:\Users\DevinL\Desktop\GCI.ps1

You can also create the script as I suggested and package it using PowerShell Studio and call that directly, cutting out the PowerShell executable and creating a line similar to this:

7=Get-ChildItem;"C:\Development\GCI.exe"
DevinL
SAPIEN Technologies, Inc.
This topic is 7 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.