Getting data from Windows PC data

Read the error again, then read the line above it again.

I didnt understand, problem, what is the problem.

should I receive data like remote computer or , directly I dont know.

Now look at the command again

Specifically, look at the query.
"Select * From Win32_Service WHERE Name Like "%SQLEXPRESS%" 1562583260990
Do you see the problem?

Understanding why something isn’t working is the first step to solving it. If needed I’ll point you in the direction of resources on how to solve it, but figuring it out yourself at first and solving it that way is in my (limited) teaching experience one of the best ways to learn and remember it in the future. And some (syntax) errors you have to get several times for the message to sink in, but there’s few things feeling as good as the next time you do it, and it won’t fail because you’re aware of it. :slight_smile:

I did like this.

but I have still error.
Get-WMIObject -Computer <192.168.2.111> -Query "Select * From Win32_Service WHERE "%SQLEXPRESS%"

Command failed: Get-WMIObject -Computer <192.168.2.111> -Query "Select * From Win32_Service WHERE "%SQLEXPRESS%" 1562588000990
/bin/sh: 1: Syntax error: Unterminated quoted string

count the “

you are missing basic knowledge - you are going to struggle big time.

Each string must start and end with a quote. " my string "

If a quote is in the middle it must be either escaped or you must use single quotes or whatever the language permits

e.g...

Get-WMIObject -Computer 192.168.2.111 -Query "Select * From Win32_Service WHERE Name Like '%SQL%'"
1 Like

I have a feeling once you get this working, you are going to ask how to split up the text based response into more meaningful / useable items.

I recommend you consider using ConvertTo-Json (powershell v3 and above)

Get-WMIObject -Computer 192.168.2.111 -Query "Select * From Win32_Service WHERE Name Like '%SQL%'"  | ConvertTo-Json 

then feed the results into a JSON node

e.g...

inject ------ exec ------- JSON ---- DEBUG

thanks for your interested but still something going wrong, I didnt install powershell for RPI 3
is it necessary for my proccess ?

When I did your advice I take this error, I think I making mistakes.

unexpected end of JSON input

Try putting a second debug node, in between exec and json.

I just tried w32Time still gives an error like below. So should I install powershell or dont need

Command failed: Get-WMIObject -Computer 192.168.2.111 -Query "Select * From Win32_Service WHERE Name Like '%W32Time%'" 1562591046459
/bin/sh: 1: Get-WMIObject: not found

Ignore Node-Red for the time being, login to your RPI at the command line using SSH and then try the same commands, That way you will get imeediate results.

Once you have it returning information you can then move further forward

Here is a basic WMI examples page - start off basic and build it up from there - remembering that you are pointing it all at a remote computer - so all of yours will start with

Get-WMIObject -Computer 192.168.2.111 (ro as appropriate for your situation)

In my experience you are better of starting with a general querying and then drilling down as your experience grows

Craig

Dear @craigcurtin is PowerShell must be installed my pi or not necessary?

The error says “command not found”, meaning you have to install whatever package containing that command, and if that is powershell then yes you have to install powershell.

1 Like

I found some installation page and try it but at the end didnt start powershell servise.

Any powershell servise installation page u advice me ?

You need to do some of the work here yourself. Do a google search for Powershell installation on RPi

I just did it and plenty of answers in there

Craig

1 Like

Powershell for Raspbian installation Instructions.

After installation, first try your commands from the commandline before trying to use node-red.

2 Likes

This is correct, install PowerShell first. You might then need to find the library that contains the command. For Windows 10, that PowerShell command is built-in but I don't know whether that is true for the Pi.

Internet searches should always be your first port of call once you get a clue given to you by the community. The following search brings up all sorts of info on how to query WMI from Linux computers for example:

1 Like

Before thanks for installation guide now powershell installed.
I run get-alias command in powershell and working on raspberry pi. But I tried another command they didnot worked. Like picture, I tried lots of command which are I found on the internet.

Thanks powershell is ok, but I will take service situation from windows xp and windows 7 just 2-3 service information , but didnt go forward

Trying to read screenshots is quite difficult especially red text on a black background.

Can’t you copy and paste the text?