Difference between running shell script through PowerCLI or interactively

This post was originally published on this site

I’m experiencing some odd issues where I have two different shell scripts and if I run them directly in the terminal they work as expected, but if I run them with PowerCLI command:

invoke-vmscript -VM UBUNTU-20.04 -scriptText “bash myScript.sh” -GuestUser xxx -GuestPassword yyy

then the execution fails after a while (differently on each script, but in both cases the script executes at least partially).


I’m new to PowerCLI, so there is probably some logic behind this behavior that I am not aware of.


First script runs a self-extracting 7z archive with wine.

If I run it interactively it is extracted as expected and then the extractor app closes.

If I run it through the PowerCLI, then the files are extracted (I can see them), but the extractor never finishes execution (process remains running, I can see it in wine TaskMgr).


Second shell script runs a python script with some proprietary API function calls.

If I run it interactively the script works as expected, runs the proprietary software and connects to it.

If I run it through the PowerCLI, then it opens the proprietary software, but then the script fails as it can not connect to this software.

I’m aware that this is a bit cryptic, and details wouldn’t help much either, but it’s just to show that the first script is not the only one causing issues under PowerCLI.


I’m using the same user account in both cases (interactively and through PowerCLI).

Both the self-extracting archive and the proprietary app are Windows applications that are running through wine.


Seeing the GUI in the first example would probably resolve this quickly, but I am not aware of any way to start a script & be able to see the GUI of processes it spawns.


Can you point me to any material that explains what differences I can expect when using PowerCLI, compared to interactive execution?

Or how I can reproduce the exact way in which these commands are executed with invoke-vmscript?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.