Running a powershell script from Ignition

Hi, I'm trying to run a simple powershell script in ignition. I'm not getting any errors, so I don't know what is wrong with it. I have 2 scripts. On the second script, I'm getting error

"Process[pid=33536, exitValue="not exited"]"

Each time I try running that script the pid changes

system.util.execute([
"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", 
"-File", 
"C:\\Users\\user\\Desktop\\writeName.ps1"
])
# Import the necessary Ignition modules
from java.lang import Runtime

# Define the path to your PowerShell script
powershell_script_path = "C:\Users\user\Desktop\writeName.ps1"

# Run the PowerShell script using the Windows PowerShell executable
Runtime.getRuntime().exec(["powershell", "-ExecutionPolicy", "Bypass", "-File", powershell_script_path])

What is the execution environment of this? Perspective? Vision? A gateway script?

This is on Vision. I'm trying to set this script up with a button

The computer that is running the vision client needs to have this file C:\Users\user\Desktop\writeName.ps1 - does it?

As well as that same path for powershell but that's a bit more uniform.

Yes, that file is available on the desktop where I am running vision client. It needs to be there

Looking at the docs, I see a couple of methods that look useful. If this is a long running script, perhaps try using waitFor() to give the script more time to complete, and if the script doesn't complete for some reason, handle it with the destroy() method.