I am trying to run a powershell script that lives on my gateway from a perspective session. Currently the script just writes out to a txt file to see if it will work but I can't get it to fire. I am trying the method shown here.
Show your code. Use the preformatted text button to make it readable.
Script in Ignition
def testRun():
system.util.execute(["powershell.exe","-File","C:\\ssh\\autoScript.py1"])
autoScript.py1 on gateway computer
$curTime = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
$filePath = "C:\ssh\log.txt"
$curTime | Out-File -Append -FilePath $filePath
Running the powershell when remoted into the gateway works.
Does the gateway service's user account have access to the C:\ssh\
folder?
Hmmm. Maybe the PATH
is different. Try spelling out the path to powershell.exe
.
I tried a couple different things like including the whole path, removing the .exe, adding -ExecutionPolicy Bypass
but none of it worked.