Exec command to remote windows machine?

Hi I am using OH with exec on my gaming rig, and I can do cool things like turn game and etc

I want to put the OH on a designated machine, and not my gaming rig
but still, want to run commands on that machine

as I see it I have two options

  1. keep OH running on the gaming pc and trigger from the new designated machine
  2. someone really smart will tell me how to invoke such command remotely?

example of the code I am using locally

Thing exec:command:Asus [command=“nircmd.exe setdefaultsounddevice 4” ,transform=“REGEX((.*?))”, interval=0, autorun=true,timeout=50 ]

never used it, but sounds like a Job for “Windows Remote Shell”:
https://msdn.microsoft.com/en-us/library/dd163506.aspx

(don’t be afraid, should work on non-Server Windows also, I think you’ll need at least Win7)

Might be easier to use psexec.

wow so quick :slight_smile: i love this fourm

but it looks very complex , lets see if there is a way with the exec to remote cmd on windows
i know that on Unix it works

You could set-up a python mqtt listener on your gaming rig to execute system commands and send mqtt message from OH

On Windows, Windows Remote Shell IS the simple approach. Windows does not support ssh the way Linux/Unix does out of the box. I don’t know much about psexec but it looks promising.

If you want to go the Python route, I’ve already have one that does this at https://github.com/rkoshak/sensorReporter

There is nothing built into Windows though that lets you easily remotely issue commands on a remote Windows unless there is some capability in PowerShell I don’t know about.

thanks for all the answers

i dediced to go with two openhabs
and i will connect them with node red

i will try to keep gaming rig as a back up system, as i dont have time to deal with pyton or any of the above cool soultions that i need to learn :slight_smile:

Seems a bit complex. You can connect them directly with each other using the MQTT Event Bus and cut out the need for a third service to connect the two. You have to use MQTT anyway to connect to NodeRed unless I’m mistaken so why not cut out the middle man?

Hi, Rich, you can use OH directly with the OH2 nodes:

It uses the Rest API. Only problem with these is that as Node-Red starts much faster than OH on reboot, it will generate errors on the OH logs before the items are defined as the rest API start before.

I have tried to get rid of it by delaying node-red start (I haven’t found a solution) OR delaying the rest api start (Not looked for it yet)

cut out the middleman? (node red right?)

what is this MQTT event bus?
can you please show me an example if you have such? for two windows PC?
I looked at docs but I am kind of a noob, there is not allot to go by

https://docs.openhab.org/addons/bindings/mqtt1/readme.html#event-bus-binding-configuration

You set up an MQTT broker, which is what would be required for NodeRed, though maybe not given Vincent’s response above. Then you use the instructions and that link to set up the event bus. Then set up items with the same name in both oh instances and the event bus will keep them in sync.

ok i did with node red, i just want to say its working great

and i will need OH ruining anyway for the MQTT bridge ,and node is ruining on my PC anyway
so i dont see a middle man here :slight_smile:

also i have a rule engine in the middle between the two PCs, so lots of benefits

thanks for all the help!

I am new to OpenHab, I want to know your software mentioned here, how does it work? Sorry I am new to everything linux/python related.

If you are referring to sensorReporter, I suggest you go to the GitHub page and read the README and look at the code. How it works is it runs as a service that you can send messages to over MQTT or receive messages over MQTT and do something in response.