Msg String to object

I execute a poweshell script which produces a string output.

msg : string[4]
"307↵"

I did not manage to parse it to a useable object.
It seems I cannot access the plain string which comes with msg.

Hi @Helix78,

Welcome to the forum.

Which node exactly (node-red-contrib-???) is giving you that message?

The node is node-red-contrib-powershell : powershell

There a PS1 is executed calling a js-file
node generic.js
console.log(307)

Normally, outputs are put into msg.payload (msg itself is the whole message object)

Can you connect a debug node to the output and show us what it displays?

The output is generated by node-red-contrib-powershell. I tried to format the output as a js object but it was still treated as a string.

This is the output of a debug node:

msg : string[4]
"307↵"

Looking at that node's code, it is simply broken. It is sending the raw String output from the powershell command as the whole message, where as it should be setting it as a property of a message object.

It's code is almost right:

  .then(output => {
     msg.payload = output;
     this.send([output, null]);
})

It does set the message property, but then sends output instead of msg.

Unfortunately the node has no github repository associated with it and it hasn't been updated in 3 years - so despite it being a simple fix to apply, there doesn't seem to be a route to doing that via this module.

I would recommend not using this node.

ok thanks. is there any alternative node I can use?

EDIT: I managed to call the node js by exec node. Now it works!