cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Alternate way to add a command

Is it possible to Add a new command (PowerShell script) by copying it directly into …\Program Files (x86)\Flexera Software\App Portal\Web\Uploads\Commands without going through the Admin (Site Management – Commands & Actions – Script Commands : NewCommand) and then updated some table(s) – like WD_clientCommands?

If not – is there any APIs to Add new command files?

 

We would then have that command be related to a named Catalog Item (to be called when a user selected ‘Install Now’), we would like to do this using PowerShell also.

We import all our new apps into App Portal using PowerShell, we also update all our existing catalog items using PowerShell, we are investigating adding commands to some of our Catalog Items – just wondering if this is feasible or if anyone has any experience doing this (or if this is a bizarre idea).

 

Thanks

(2) Solutions
CharlesW
By Level 12 Flexeran
Level 12 Flexeran
No, there are definitely no API's which would allow you to create a new command action, or to add a command to an existing catalog item.. I'm not condoning direct manipulation of the App Portal DB, but there are only two tables involved here.. The WD_ClientCommands table stores the commands, and the WD_Actions table stores the mappings between the commands and catalog items... In theory, it would be easy enough to insert rows into these tables.

View solution in original post

You won't be able to run this PowerShell script directly, but it does have a function called AddScriptCommandToEvent to set an existing action on a specified event for a given catalog item.  I never created a function to programmatically create new script commands, because we normally just create them from the UI.  But as long as they exist, the function in the attached script will connect them to your catalog items.

Anything expressed here is my own view and not necessarily that of my employer, Flexera. If my reply answers a question you have raised, please click "ACCEPT AS SOLUTION".

View solution in original post

(3) Replies
CharlesW
By Level 12 Flexeran
Level 12 Flexeran
No, there are definitely no API's which would allow you to create a new command action, or to add a command to an existing catalog item.. I'm not condoning direct manipulation of the App Portal DB, but there are only two tables involved here.. The WD_ClientCommands table stores the commands, and the WD_Actions table stores the mappings between the commands and catalog items... In theory, it would be easy enough to insert rows into these tables.

You won't be able to run this PowerShell script directly, but it does have a function called AddScriptCommandToEvent to set an existing action on a specified event for a given catalog item.  I never created a function to programmatically create new script commands, because we normally just create them from the UI.  But as long as they exist, the function in the attached script will connect them to your catalog items.

Anything expressed here is my own view and not necessarily that of my employer, Flexera. If my reply answers a question you have raised, please click "ACCEPT AS SOLUTION".

Thanks, this was something we were investigating. It's good to know it is possible. 

I think we might be able to create just one command and import it in the correct way and then use a template to assign it to future Catalog items. We can pass in different variables each time to the command ( ##MachineName##  ##PackageID##) which should run the script to get the specific outcome we want for each catalog item.