Execute script from openhabian to a remote windows 10 PC

Hi all,

First of all, I am a newbie, sorry for that.

As the title mentions, I am looking for a way to run batch scripts that I have on my personal windows 10 computer from the raspberry pi where I have openhab installed.

Basically what I want to achieve is that I will trigger those batch files to control the volumen of my PC by using Alexa ( the part about triggering stuff via rules and Alexa I have already sorted out as I use it for switching on my lights).

I just need a way to run the script on the remote computer which is also in the same network, I have been checking what´s possible with “executecommandline” but honestly I did not find a quick solution and I really think this can be done with a couple of lines of code.

Is there any able to help me out?

Thanks a lot!

Couple of likely looking suggestions in this thread

Thanks a lot!!!

I reviewed already, will check it out deeper and try to set up this afternoon, however what I don´t understand fully is why would I need to also install something to handle with the requests on the windows PC is there not a way that I can trigger things like “shutdown /s /t 1200” by adding destination ip + user + password of the user from the raspberry?

Well, Windows is designed to stop people sending it random requests to do stuff.

Shutdown is a whole other topic with specific solutions that you didn’t ask about before, there are lots more threads about that.

I don´t think is another topic! as I can just run that script by using my batch file that I have sitting on my desktop right? If I would manage to run a script on the windows 10 pc I can do whatever I want.

I know window is designed to stop people but from windows if I am not mistaken you can already send even powershell scripts from machine A to machine B on the same network, so I am looking from similar approach.

It’s up to you. First pick your tool.
Powershell psexec would probably do.

Then, when you know what message to send where, you can look at how to get openHAB to send the message via HTTP or whatever.

Exactly, basically, that´s what I am looking for. A way to get openhab to send those messages.

Something like (+ adding user-pass as a parameter):

psexec \\RemoteServerNameOrIP d:\shutdown.bat

That’s a command line to be executed. There is no psexec on your openHAB server to execute. What message do you need to send to the Windows box? This is why people use an add-on tool at the Windows end, to receive messages.

Relevant -

So after review I am doing the following bellow.
I am using IOT Link (windows 10) + openhab (raspberry) with mosquitto that makes the mqtt link possible.

You’ve already solved your problem, but here’s another option if it doesn’t work out.

I thought about moving to IOTLink to gain flexibility, but ACC has worked reliably for me since I set it up so I haven’t messed with it.

Thanks a lot! So far I am able to do everything I want with IOT Link, after I solved this issue now I am able to run my scripts on the PC which enables me to achieve almost everything I want.

Also, the point about IOT Link is that everything is in my network and the only thing that it´s outside of my control is what I say to Alexa, other than that, I don´t need to use a third-party server, that´s why I was looking for a solution like this as I did not want to give any type of control to a externals to run anything on my personal computer.

I was also exploring “TRIGGERcmd: Ejecute comandos de forma remota en sus computadoras.” as it is super straightforward as well, but again, my PC would be exposed.

Note that ACC doesn’t do anything external. Essentially, you set up IFTTT to place text files in your personal cloud storage drive, which are then synched to your PC and read by ACC. So the only way it could be compromised is if someone had your Google, Dropbox, or Microsoft credentials. And then you have bigger problems.

I’m not arguing with your choice, just clarifying for other readers.

Some folks don’t like relying on Internet services, and in most cases I agree. I tried to take IFTTT out of the loop by having ACC monitor a shared drive on my OH server, but couldn’t get it working. It’s not a big deal if my PC doesn’t turn off immediately, so I haven’t worried about it.

1 Like