set(True = false)

Citect Scada 2018- How to execute a Windows PowerShell Script

Hi,

I want to insert a string variable to my powershell script and then execute the powershell script. 

I've tried following :

DDEWrite("PowerShell", "C:\netsim\GotoOpcBlock.PS1", "paramOpcAddress", "MAINRACK.R_SYSCON.B_NAME");

This seems to start the powershell but, a powershell window complains about "File cannot be loaded because running script is disabled on this system". 

When I run Get-ExecutionPolicy the status is "RemoteSigned". I have also installed latest Windows Powershell. If I execute the powershell script from Windows Explorer the script runs fine and does what its supposed to do. 

Parameter SECURITY-BlockExec is set to 0, Allow Exec = TRUE, Allow RPC = TRUE

I'm not sure DDEwrite is the right function to execute a powershell script, its the closes I have found so far.

Appreciate all inputs and guides on solving this. 

Thanks

Regards

Rune

Parents
  • Solved it by using the Exec function.

    GAPFilePath and GAPBlockName defined as String variables

    Exec("C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe C:\netsim\GotoOpcBlock2.PS1" + " " + GAPFilePath + " " + GAPBlockName);
Reply
  • Solved it by using the Exec function.

    GAPFilePath and GAPBlockName defined as String variables

    Exec("C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe C:\netsim\GotoOpcBlock2.PS1" + " " + GAPFilePath + " " + GAPBlockName);
Children
No Data