Execute a powershell script into sambapos V5

Hi,ùusing sambapos v3 we have an action that execute a .cmd file that execute a powershell… now in sambapos v5 we canno’t execute .cmd or bat file. so, can we execute the powershell directly from sambapos?

the powershell read a .txt file created by sambapos after the payment tipe selection and transfer the bill to the PMS…

we wrote a little mdb over a vpn connection.

If (Test-Connection -count 1 -quiet) {
     if (Test-Path C:\temp\prova.txt){

$a = (Get-Content C:\temp\prova.txt)

$camera = $a[4].Replace("Camera: ", "")

$codice = $a[5].Replace("Codice:", "")

$totale = $a[7].Replace("Totale:", "")
$totale_e = "€ "+$totale

$date = Get-Date
$data_completa = $date.ToShortDateString()

if (($camera -eq $null) -Or ($codice -eq $null) -Or ($totale -eq $null)) {

$a = new-object -comobject wscript.shell
$b = $a.popup("Non è stato possibile caricare tutte le informazioni in SistemaHotel",10,"Errore addebito in camera",0)


    $adOpenStatic = 3
    $adLockOptimistic = 3

    $objConnection = New-Object -com "ADODB.Connection"
    $objRecordSet = New-Object -com "ADODB.Recordset"

    $objConnection.Open("Provider = Microsoft.ACE.OLEDB.12.0; Data Source = Z:\CONTO_CLIENTE.MDB")

    $objRecordset.Open("Select * From Conto_Cliente", $objConnection,$adOpenStatic,$adLockOptimistic)

    $objRecordSet.Fields.Item("NumeroHotel").Value = "1"
    $objRecordSet.Fields.Item("CodiceCliente").Value = "$codice"
    $objRecordSet.Fields.Item("NumeroCamera").Value = "$camera"
    $objRecordSet.Fields.Item("DataAddebito").Value = "$datenow"
    $objRecordSet.Fields.Item("NumeroConto").Value = "1"
    $objRecordSet.Fields.Item("VoceFattura").Value = "1000"
    $objRecordSet.Fields.Item("VoceAddebito").Value = "1000"
    $objRecordSet.Fields.Item("Descrizione").Value = "BAR ESTERNO"
    $objRecordSet.Fields.Item("Importo").Value = "$totale_e"
    $objRecordSet.Fields.Item("Unitario").Value = "$totale_e"
    $objRecordSet.Fields.Item("Quantità").Value = "1"
    $objRecordSet.Fields.Item("Fatturato").Value = "S"
    $objRecordSet.Fields.Item("DataFattura").Value = "$datenow"




Remove-Item C:\temp\prova.txt

     $e = new-object -comobject wscript.shell
     $f = $e.popup("Addebito non contabilizzato. Chiamare assistenza",60,"Errore connessione VPN",0)

There is an action to execute those. I forget it’s name exactly. However with v5 you can write Jscript and execute that directly without need for PowerShell.

It is call Start Process.


sukasem is correct.

The Action in V4 and V5 is called Start Process. It can start anything (BAT, CMD, PS, Explorer, Calc.exe, etc).

You can also run Powershell from JScript in V5.

You can also use JScript in V5 to hook any C# or .NET Assembly / Library, so you may not even need Powershell or BAT/CMD.

V5 is like 10000000x more powerful/flexible than V3, or even V4 for that matter.