cancel
Showing results for 
Search instead for 
Did you mean: 

Shell execute pass - Powershell Hanging

brandonbollin
Active Participant
0 Kudos

Good morning experts,
I swear I've seen this problem before but I cannot pinpoint where and searching SCN hasn't yielded results.

Anyway, I have a client who's got a Shell execute pass that's doing some work with a CSV file. When the line executes, the Powershell.exe program doesn't seem like it's closing. The instance stays resident in memory until so many instances of it are running in memory that an intervention is necessary to close all the hanging Powershell sessions.

Anyone have any ideas how to make sure the Powershell.exe instance exits once the pass has concluded?

Accepted Solutions (1)

Accepted Solutions (1)

lambert-giese
Active Participant

Brandon,

in the task parameters of your Shell Execute pass, try adding a line:

Parameter name: CLOSEOUTPUTSTREAM
Parameter value: 1

Kind regards,
Lambert

brandonbollin
Active Participant
0 Kudos

Can you share a screenshot of what something like this would look like? I'm not sure I understand this answer. Do you just put, "CLOSEOUTPUTSTREAM = 1" on a new line under the Powershell execution line?

lambert-giese
Active Participant
0 Kudos

You don't find it because "Shell Execute" doesn't offer task parameters at all. My answer was misleading, sorry.

You'll need to use a "To Custom" pass instead of "Shell Execute", like so:


brandonbollin
Active Participant
0 Kudos

I see where you're going with this. Is ToShell a preexisting Java class or would I need to create the class so IDM can call it?

lambert-giese
Active Participant
0 Kudos

It exists and is the same class that would be called when using a "Shell Execute" pass. It's just that "To Custom" is more generic and hence allows passing of parameters like "CLOSEOUTPUTSTREAM", which the more specialized "Shell Execute" UI of MMC doesn't offer - for whatever reason.

brandonbollin
Active Participant
0 Kudos

A year ago when I asked this question, we ended up finding another way to do what needed to be done so the PowerShell script portion was eliminated and I forgot about this question. Today, I was running into the same problem but with a different client and came back across this question. I implimented your answer and it worked! Many thanks!

Answers (2)

Answers (2)

0 Kudos

If you are using command line you need to add this lines before calling the ps1 file

-NoLogo -Noninteractive -InputFormat None -NoProfile

former_member2987
Active Contributor
0 Kudos

Hey Brandon,

Are you using any command line parameters? You might need /c with that. I think you need it just about any time you do a shell execute from IDM.

You can find a listing of the command line parameters here.

Matt

brandonbollin
Active Participant
0 Kudos

I have discussed this answer with our client and they're going to try it. Unfortunately we cannot do this ourselves directly to know if it's successful so I'll update when I have more information. Thanks as always, Matt. 🙂

former_member2987
Active Contributor
0 Kudos

No worries, Brandon... You should be able to verify this on a test system easily enough as well.

brandonbollin
Active Participant

Test system? I like the world you live in. 🙂