i am trying to set up a way to shutdown my windows pc remotely from nodered. as of now i managed to do it through mqtt but it doesnt always work. so i used to have a raspberry pi with home assistant on it and it had a samba integration that could send an rpc shutdown command to the pc and it would shut down no problem. since i migrated everything on nodered ( running on a qnap nas) i wasnt able to find a way to get that rpc shutdown working again. could anyone share their flow or an alternative that works reliably?
Depending on the OS of the WIndows machine - i would assume windows 10
Install WSL (or WSL2) - SSH to the windows machine and send a shutdown command from in the Linux shell - this can be done with SSH keys so no passwords needed (you would call an Exec node from NR to run a Bash script on the QNAP
Install NR on the Windows machine and send it a MQTT message to perform an exec at that end and call a Windows Batch file or PS script to perform a native shutdown
There are lots of ways to remotely control a Windows PC though many of them require some configuration changes to allow remote management scripting (e.g. enabling WMI).
Have you tried using shutdown from WSL? I'm not 100% sure it would work since WSL is actually a lightweight VM. You can also get remote SSH access by using the (now native) OpenSSH service that has a server component