# Getting data from Windows PC data

**URL:** https://discourse.nodered.org/t/getting-data-from-windows-pc-data/12910
**Category:** Dashboard
**Tags:** windows
**Created:** [4 July 2019 15:07 UTC](https://discourse.nodered.org/t/getting-data-from-windows-pc-data/12910 "2019-07-04T15:07:08Z")
**Posts on this page:** 20
**Page:** 2

<div class="post-metadata">

### Author: ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)
#### Post date: [8 July 2019 11:57 UTC](https://discourse.nodered.org/t/getting-data-from-windows-pc-data/12910/21 "2019-07-08T11:57:00Z")

</div>

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

---

<div class="post-metadata">

### Author: ![wtrk](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@wtrk](https://discourse.nodered.org/u/wtrk)
#### Post date: [8 July 2019 12:03 UTC](https://discourse.nodered.org/t/getting-data-from-windows-pc-data/12910/22 "2019-07-08T12:03:45Z")

</div>

I didnt understand, problem, what is the problem.

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

---

<div class="post-metadata">

### Author: ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)
#### Post date: [8 July 2019 12:07 UTC](https://discourse.nodered.org/t/getting-data-from-windows-pc-data/12910/23 "2019-07-08T12:07:45Z")

</div>

> [@wtrk](#):
>
> ```auto
> Unterminated quoted string
> 
> ```

Now look at the command again

> [@wtrk](#):
>
> `Get-WMIObject -Computer <192.168.2.111> -Query "Select * From Win32_Service WHERE Name Like "%SQLEXPRESS%" 1562583260990`

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. 🙂

---

<div class="post-metadata">

### Author: ![wtrk](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@wtrk](https://discourse.nodered.org/u/wtrk)
#### Post date: [8 July 2019 12:14 UTC](https://discourse.nodered.org/t/getting-data-from-windows-pc-data/12910/24 "2019-07-08T12:14:38Z")

</div>

> [@afelix](#):
>
> Get-WMIObject -Computer \<192.168.2.111\> -Query "Select \* From Win32\_Service WHERE Name Like "%SQLEXPRESS%" 1562583260990

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

---

<div class="post-metadata">

### Author: ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)
#### Post date: [8 July 2019 12:23 UTC](https://discourse.nodered.org/t/getting-data-from-windows-pc-data/12910/25 "2019-07-08T12:23:24Z")

</div>

count the “

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [8 July 2019 12:23 UTC](https://discourse.nodered.org/t/getting-data-from-windows-pc-data/12910/26 "2019-07-08T12:23:55Z")

</div>

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...

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

```

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [8 July 2019 12:41 UTC](https://discourse.nodered.org/t/getting-data-from-windows-pc-data/12910/27 "2019-07-08T12:41:20Z")

</div>

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](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/convertto-json) (powershell v3 and above)

```auto
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`

---

<div class="post-metadata">

### Author: ![wtrk](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@wtrk](https://discourse.nodered.org/u/wtrk)
#### Post date: [8 July 2019 12:51 UTC](https://discourse.nodered.org/t/getting-data-from-windows-pc-data/12910/28 "2019-07-08T12:51:15Z")

</div>

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

 ![Untitled](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/f/f23f99cf028aa732682a6faa558b899c609ff670.png)

---

<div class="post-metadata">

### Author: ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)
#### Post date: [8 July 2019 12:59 UTC](https://discourse.nodered.org/t/getting-data-from-windows-pc-data/12910/29 "2019-07-08T12:59:26Z")

</div>

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

---

<div class="post-metadata">

### Author: ![wtrk](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@wtrk](https://discourse.nodered.org/u/wtrk)
#### Post date: [8 July 2019 13:05 UTC](https://discourse.nodered.org/t/getting-data-from-windows-pc-data/12910/30 "2019-07-08T13:05:09Z")

</div>

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

---

<div class="post-metadata">

### Author: ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)
#### Post date: [8 July 2019 17:01 UTC](https://discourse.nodered.org/t/getting-data-from-windows-pc-data/12910/31 "2019-07-08T17:01:13Z")

</div>

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

---

<div class="post-metadata">

### Author: ![wtrk](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@wtrk](https://discourse.nodered.org/u/wtrk)
#### Post date: [8 July 2019 18:17 UTC](https://discourse.nodered.org/t/getting-data-from-windows-pc-data/12910/32 "2019-07-08T18:17:45Z")

</div>

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

---

<div class="post-metadata">

### Author: ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)
#### Post date: [8 July 2019 18:46 UTC](https://discourse.nodered.org/t/getting-data-from-windows-pc-data/12910/33 "2019-07-08T18:46:59Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![wtrk](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@wtrk](https://discourse.nodered.org/u/wtrk)
#### Post date: [8 July 2019 19:28 UTC](https://discourse.nodered.org/t/getting-data-from-windows-pc-data/12910/34 "2019-07-08T19:28:27Z")

</div>

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

Any powershell servise installation page u advice me ?

---

<div class="post-metadata">

### Author: ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)
#### Post date: [8 July 2019 20:03 UTC](https://discourse.nodered.org/t/getting-data-from-windows-pc-data/12910/35 "2019-07-08T20:03:36Z")

</div>

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

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [8 July 2019 20:22 UTC](https://discourse.nodered.org/t/getting-data-from-windows-pc-data/12910/36 "2019-07-08T20:22:44Z")

</div>

Powershell for Raspbian installation [Instructions](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-6#raspbian).

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

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [8 July 2019 21:35 UTC](https://discourse.nodered.org/t/getting-data-from-windows-pc-data/12910/37 "2019-07-08T21:35:04Z")

</div>

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:

> **[Startpage.com - The world's most private search engine](https://www.startpage.com/rvd/search?query=query%2520wmi%2520from%2520a%2520linux%2520computer&language=auto)**
>
> Startpage.com delivers online tools that help you to stay in control of your personal information and protect your online privacy.

---

<div class="post-metadata">

### Author: ![wtrk](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@wtrk](https://discourse.nodered.org/u/wtrk)
#### Post date: [9 July 2019 06:41 UTC](https://discourse.nodered.org/t/getting-data-from-windows-pc-data/12910/38 "2019-07-09T06:41:55Z")

</div>

> [@bakman2](#):
>
> Powershell for Raspbian installation [Instructions](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-6#raspbian).
> 
> After installation, first try your commands from the commandline before trying to use node-red.

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.

 ![Untitled](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/8/8d53a594ebd72f4f13294eb83ff6fa7b909cfc43.png)

---

<div class="post-metadata">

### Author: ![wtrk](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@wtrk](https://discourse.nodered.org/u/wtrk)
#### Post date: [9 July 2019 06:44 UTC](https://discourse.nodered.org/t/getting-data-from-windows-pc-data/12910/39 "2019-07-09T06:44:06Z")

</div>

> [@TotallyInformation](#):
>
> 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:
> 
> [Startpage Search Results](https://www.startpage.com/rvd/search?query=query%20wmi%20from%20a%20linux%20computer&language=auto)

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

---

<div class="post-metadata">

### Author: ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)
#### Post date: [9 July 2019 06:44 UTC](https://discourse.nodered.org/t/getting-data-from-windows-pc-data/12910/40 "2019-07-09T06:44:42Z")

</div>

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

Can’t you copy and paste the text?

[Previous page](https://discourse.nodered.org/t/getting-data-from-windows-pc-data/12910.md?page=1)

[Next page](https://discourse.nodered.org/t/getting-data-from-windows-pc-data/12910.md?page=3)
