Has anyone called PowerShell from Process Flow?

 7 Replies
 1 Subscribed to this topic
 52 Subscribed to this forum
Sort:
Author
Messages
Tom Sinkula
Basic Member
Posts: 17
Basic Member
    I'm trying to call PowerShell from Process Flow (actually Lawson Process Automation) using the System Command node.  It seems to hang on the startup of powershell and finally timeout.
    pbelsky
    Veteran Member
    Posts: 80
    Veteran Member
      Let's see if we can get some new interest in this thread. I am executing a batch file in LID that runs a powershell script. The script runs successfully, but control is not returned to the LID command prompt. I have to manually hit enter to get the command prompt to come back.

      Has anyone else encountered this issue and solved it? Thanks!
      Tom Sinkula
      Basic Member
      Posts: 17
      Basic Member
        I believe I'm seeing a similar issue when starting a PowerShell script from Process Flow, i.e., it looks like the script runs but control is never returned. I opened an INFO incident with Support and they have indicated they will develop a fix for this (as far as Process Flow and LPA are concerned). Not sure what implications this will have when accessing PowerShell from LID, though.
        pbelsky
        Veteran Member
        Posts: 80
        Veteran Member
          Was able to answer my own question. I experimented with Windows task manager and found that if I ended poweshell.exe, my LID prompt would come back. So I added the following cmdlet to the end of my powershell script:

          stop-process -processname powershell

          This worked. Powershell script ran and returned control to LID. Tom, I'm not sure if ProcessFlow is running your ps script before hanging or not, but if it is, this might help.

          Patti Belsky
          Tom Sinkula
          Basic Member
          Posts: 17
          Basic Member
            Thanks Patti,

            I'll give it a try.

            Tom
            pbelsky
            Veteran Member
            Posts: 80
            Veteran Member
              Hey Tom, a little more info on this. When I used the stop-process cmdlet to return control to the LID prompt successfully yesterday, I was doing that on our dev system. Today I moved all my code into the QA system, where security is a little tighter. When I ran the powershell script from a batch file using LID, I received the following error in QA:

              Stop-Process : Cannot stop process "powershell (6356)" because of the following
               error: Access is denied


               My powershell script creates an output file, so I checked that and found that the file was indeed created, it was just hanging up on the auth for the stop-process. 

              We have a custom COBOL batch program that allows us to execute batch files from the Lawson back office portal. When I executed the batch file / powershell script using the COBOL program, again the file was created, but the job hung, without any error message.

              My experience led me to wonder if it is possible to execute your powershell process from LID by using a batch file? At least that way, you might get an error message that will help you figure out what is going on. Put your powershell script in the work directory on the Lawson app server, and use a command like this in your batch file:

              powershell.exe d:\test\law\test\work\test.ps1









              pbelsky
              Veteran Member
              Posts: 80
              Veteran Member
                To wrap this up... we were able to get a Lawson batch job which calls a powershell script to run AND complete successfully from portal, instead of hanging. As the end of the powershell script, we added the following cmdlet:

                stop-process powershell -force

                It was the -force that finally solved our problem, and enabled the program to complete.

                This doesn't surprise me because we have seen similar behavior between Lawson and msoft -- when our users are working with query wizard add-in, excel.exe will often hang on their machine, and as they continue to open more saved queries, they will start to have trouble because of multiple hanging instances of excel.exe. We have taught them to go into task mgr and end the extra excel.exe's out there.

                Good luck and Happy Holidays, Tom!
                pbelsky
                Veteran Member
                Posts: 80
                Veteran Member
                  In case anyone is interested, Lawson just came out with an environment patch for this issue.

                  JT-405778  Running powershell scripts on the System Command node result in Timeout