Forum Discussion

TIMOTHY_MANGAN's avatar
Oct 26, 2021

Invoke-CommandInDesktopPackage needs a -Wait parameter

When scripting in PowerShell, I find it necessary to start a process inside a package and wait for it to finish before continuing on.

 

The Invoke-CommandInDesktopPackage returns immediately with no output upon successful launching of the command.  It would be helpful to have a new -Wait parameter on the cmdlet to request waiting, or to return an object that could be used (such as the new process object) for this purpose.

  • Hi TIMOTHY_MANGAN,

     

    Thank you for the feedback. I'd like to ask how you would like to use this PowerShell cmdlet:

    • It sounds like you may want to wait and force a return from this cmdlet and not just wait with zero returned values. Is that correct?
    • What types of information would you like to retrieve by using this Cmdlet?
    • Can you provide an example of how you'd like to use this cmdlet going forward?

    Thank you,

    Roy MacLachlan

    • TIMOTHY_MANGAN's avatar
      TIMOTHY_MANGAN
      MVP

      Waiting is the minimum requirement, but having access to the exit code of the command is desired. My preference is to just wait rather than loop on a handle.  But there might be others that want the full control to monitor and take parallel action I suppose.

      The use is a substitution for starting a process. I have found it necessary to use this method to get cmd scripts to run inside of the container and I need this command to complete prior to an additional action. As I don't have control over the contents of the cmd script, I cannot add the additional action there.

Resources