Getting data from Windows PC data

Hi guys
I connected my raspberry pi to windows pc.
I just want to see my windows data power on-off and CPU usage.

Is it possible to monitor some windows datas at Node-Red on raspberry pi

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.

Actually, I mean just want to see widows situation is on or off, not shut down or on.

So I just want to see SQL express server on the windows and maybe windows cpu usage.
Just this.

I need some more information, my wmi is ok and after this what kind of things I have to do.
Could you please give me some more information

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 :slight_smile:

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

https://docs.microsoft.com/en-us/windows/win32/wmisdk/connecting-to-wmi-on-a-remote-computer
https://docs.microsoft.com/en-us/windows/win32/wmisdk/connecting-to-wmi-on-a-remote-computer-by-using-powershell

Yes, all doable via remote WMI. You could even start/stop services and reboot if you have the right authentication.

I didnt understand sorry. I want to see some services via nodered monitoring.

WMI service activating and working on windows OS. How can I receive services situation on the node red

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.

https://npms.io/search?q=wmi

1 Like

Better still:

https://www.krenger.ch/blog/wmi-commands-from-linux/

Which gives you a WMI command line client for Linux that you can use to directly query WMI on a remote Windows device.


Ah, in fact I'd forgotten that there are WMI clients for Linux too! Some pointers might be in this package:

1 Like

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.

1 Like

Thank you for your support but didnt succeed it, could you please show me it basic flow ?

Which bit did you not succeed with?

Basically my rpi connected windows pc with cable.
I connect raspberry with wireless.

I activated windows pc wmi service or already activated.

I dont know what kind of flow I should create.

That's your issue. You should connect your Pi and your PC to the local network. Then you can use the network to communicate.

I connected pi and computer with switch and both of them Same network.

Pi:192.168.1.20
Pc:192.168.1.21
What kind of flow I have to create could you please help me ?

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.

Good luck in your endeavours.

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.

So I need help morethan now

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":[]}]