Hey everyone! I'm encountering a strange issue with two scripts that are supposed to do similar tasks. Both scripts are triggered by another script (which I'll call "Parent"). The kicker is that Parent is supposed to keep running while these two scripts operate in the background, but I'm having problems with one of them.
The first script runs flawlessly, even in hidden mode; it waits for a specific process (named "AdODIS-Installer") to start and continues functioning without issues. However, the second script—the more complex one—is causing Parent to hang while it waits for the desired process (which is just named "Installer") to start.
I can't figure out why the second script is blocking Parent when both are executed in the same manner. Interestingly, when I inject a status code (like "12345") into the first "while" loop of the second script, it exits correctly, indicating that the issue lies within that loop.
I've maintained the same hidden execution process for both scripts, so this is quite baffling. Have any of you run into similar issues, or do you have any insights on what might be going wrong?
3 Answers
After looking at your scripts, I suggest using `Get-Process` in the second closing loop without too many filters, just to make sure you're catching anything relevant. Also, using `-like` could be enough to get the desired results without complicating things.
It sounds like there could be too many conditions in your second script, which might be unnecessary. To troubleshoot, try running script 2 without hiding it to see what’s actually happening. Also, consider adding more detailed logging to track its progress. It seems that script 2 depends on script 1 starting correctly, so maybe it’s not launching as expected from Parent?
You make a good point! The process launch might not be happening correctly. I’m wondering if there’s an issue with how the scripts are waiting for the right processes to be initiated.
Finding where it gets stuck is definitely key here. Try running without the hidden mode to observe the output, or log the output to a file for later review. This will help you identify where the wait is happening.
Exactly! I know it's getting stuck in the first while loop, but it confuses me why it's blocking the parent script. I'll have to investigate further.

Great tip! I’ll try that approach after dinner. Thanks for the awesome feedback!