I’m not sure about power on/off, but there are a couple MQTT based tools that support Windows, allowing for stats to be published to an MQTT topic, and be subscribed to from Node-RED. Another allows remote command execution to Windows machines over MQTT
psmqtt is Python based and uses the python library psutil on the inside. Both are cross platform.
Winthing is java based, and allows command execution over MQTT.
Lots of ways to do this. However, some will require you to turn on the remote interface for the Windows Management Interface (WMI).
An alternative is that you can run Telegraf as a Windows service and it has several ways to get information about the local Windows environment.
Another way - which probably does require remote WMI enabled - is to use PowerShell v6 Core which runs on Linux just fine and has extensions for all manner of remote information gathering and control.
Can you clarify what you mean by “windows data power on-off”, is that the power usage of the computer, or whether it’s on or not, or something else entirely?
As for sql express server, do you want to check if it’s running, or turning it on/off? From what I remember from my sqlserver days on Windows (some 6 years ago) it was always running until you stopped the service. Do you want to interact with the Windows Services to see the status?
Edit: Julian (@TotallyInformation) is far more of a windows expert, I’m stepping back from this topic, appears the end of my knowledge on this is reached already
I mean windows has electric and working or not actually.
And some services maybe working or stopped just this I want to monitor in nodered with button.
Its like;
red button SQL Express service stopped.
green button SQL Express service working
By accessing WMI through some method that can be triggered by Node-RED and will get data back into Node-RED.
The simplest place to start is probably at the command line. So if you have Node-RED running on Linux, perhaps install Microsoft PowerShell Core for Linux and create a PowerShell script that queries WMI remotely to, lets say, get the current status of SQLserver.
Once you have a script that prints the status to the command line, you can then run that from within Node-RED using the Exec node and the command line output will come back into Node-RED.
To go beyond that, you may need to see if there is a Node.JS package to interface with WMI - there are various ways to get that working with Node-RED from loading into a global variable using the settings.js file through to writing a custom node.
As I say, the alternative would be to install Telegraf on the Windows device and InfluxDB somewhere accessible to both the Windows device and the Linux device. Then you can use the InfluxDB node to query the db periodically to get the stats you want.
Hi, you'll find very knowledgeable guys here who are, for free of course, more than willing to help out.
However, we normally expect that you have tried something for yourself and got stuck.
There has been some advice offered already, including using WMI.
I would suggest you investigate these. Also look into methods of how to get status from a windows computer, search this forum and the internet. Come up with a method, give it a go and when you get stuck, post your progress here. You will find the help far more forthcoming if you actually try something yourself first.
As you see searching and trying.
If I know I just do this, didnt ask more.
This is not interested only nodered, windows, linux maybe network experiences needed.
I connected pi and pc and used exec node but not working I take this error.
I can ping from pi to pc but didnt know how can I take situation information from pc
Command failed: Get-WMIObject -Computer <192.168.2.111> -Query "Select * From Win32_Service WHERE Name Like "%SQLEXPRESS%" 1562583260990
/bin/sh: 1: Syntax error: Unterminated quoted string
my node is basically this
[{"id":"e43c8d40.38f3a","type":"inject","z":"e7e1387c.9f7928","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":220,"wires":[["4f3b36ad.d69398"]]},{"id":"4f3b36ad.d69398","type":"exec","z":"e7e1387c.9f7928","command":"Get-WMIObject -Computer <192.168.2.111> -Query \"Select * From Win32_Service WHERE Name Like \"%SQLEXPRESS%\"","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":600,"y":160,"wires":[["e7296898.75e458"],[],[]]},{"id":"e7296898.75e458","type":"debug","z":"e7e1387c.9f7928","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1130,"y":160,"wires":[]}]