How to Run Command in Powershell


I have just purchased a USB Power Relay. I have got it to turn On and Off using the powershell to open a file with the code in it. How do I access Windows Powershell from a Xojo Web App?

I have tried

[code]Dim s as Shell
s = new Shell




But this just seems to open the Command Prompt.

Can anybody point me in the right direction.

what does “powerOn.ps1” contain ? it should be the name and location of your powershell script .

Try: s.Execute(“powershell C:\Users\\powerOn.ps1”)

Thanks for the suggestions. I tried the above but got an error 1.

Hear is the contents of the file ‘powerOn.ps1’

[Byte[]] $powerOn = 0xA0, 0x01, 0x01, 0xA2 [Byte[]] $powerOff = 0xA0, 0x01, 0x00, 0xA1 $robojax = new-Object System.IO.Ports.SerialPort COM3,9600,None,8,one $robojax.Open() $robojax.Write($powerOff,0,$powerOff.count) $robojax.Close()

Should I be using the Serial Communicator instead?

Xojo’s Serial Class is the right way to go.

Thanks [quote=466909:@LangueR]Xojo’s Serial Class is the right way to go. [/quote]

Thanks for the tip. I ended up getting it working with the follow code. By replacing the ‘0x’ with ‘&h’

SerialController.Write(DecodeHex("&hA0, &h01, &h00, &hA1"))