Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WQL Syntax "Where" is not working #32

Open
bluems opened this issue Apr 17, 2018 · 1 comment
Open

WQL Syntax "Where" is not working #32

bluems opened this issue Apr 17, 2018 · 1 comment

Comments

@bluems
Copy link

bluems commented Apr 17, 2018

Select * from Win32_NetworkAdapterConfiguration where.....

it's WQL is not working.

Check, pls.

Powershell is working it

@mschlegel81
Copy link

mschlegel81 commented Aug 29, 2020

In my specific case I wanted to modify generated Free Pascal code to query one specific Win32_Process instead of all of them.

Generated query statement:
FWbemObjectSet:= FWMIService.ExecQuery('SELECT * FROM Win32_Process','WQL',wbemFlagForwardOnly);

The following naive modification does not work (and thus seems to reproduce the above error) - this should be one line:
FWbemObjectSet:= FWMIService.ExecQuery('SELECT * FROM Win32_Process WHERE ProcessId='+intToStr(GetProcessID),'WQL',wbemFlagForwardOnly);

What did finally work was to assign the very same query to a variable of type OLEVariant first.
query:='SELECT * FROM Win32_Process WHERE ProcessId='+intToStr(GetProcessID);
FWbemObjectSet:= FWMIService.ExecQuery(query,'WQL',wbemFlagForwardOnly);

Hope that helped.
Martin

Sorry. I forgot to specify; OS: Windows 10, Compiler: FPC 3.2.0 for Win64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants