Questions tagged [wql]

The WMI Query Language (WQL) is a subset of the American National Standards Institute Structured Query Language (ANSI SQL)—with minor semantic changes.

Windows Management Instrumentation Query Language (WQL) is Microsoft's implementation of the CIM Query Language (CQL), a query language for the Common Information Model (CIM) standard from the Distributed Management Task Force (DMTF). It is a subset of the standard ANSI SQL with minor semantic changes. A basic WQL query remains fairly understandable for people with basic SQL knowledge.

WQL is dedicated to WMI and is designed to perform queries against the CIM repository to retrieve information or get event notifications

198 questions
2
votes
0 answers

WMIC enconding issue when run command from Linux

I'm trying to get informations from a windows machine using WMIC in Linux. Basically, my commands looks like below: wmic '--authentication-file=/tmp/auth_file' '//127.0.0.1' 'SELECT Name FROM Win32_ComputerSystem' The connection works fine and the…
James
  • 1,653
  • 2
  • 31
  • 60
2
votes
1 answer

VBScript WQL Sort Result Set?

Apparently WQL does not contain an ORDER BY clause. Is there a way to sort the result set based on one of the columns? For example: Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") sSQL = "Select…
Neil Weicher
  • 2,370
  • 6
  • 34
  • 56
2
votes
0 answers

WMI SoftwareLicensingProduct class doesn't show Partial Product Key for MS Office on some systems ( Windows 10)

Using WMI SoftwareLicensingProduct class I am fetching Partial Product Key / License Key for Microsoft Product. Its compatible with Windows Vista and above. But still I am not able to retrieve the Key for MS Office on few Windows10 system, for rest…
2
votes
2 answers

Reliably get Latest Event Log Record with WQL

I have written an application which collects windows logs from linux, via the Zenoss wmi-client package. It uses WQL to query the Event log and parses the return. My problem is trying to find the latest entry in the log. I stumbled across this…
Greg Olmstead
  • 1,551
  • 10
  • 22
2
votes
0 answers

speed up WQL query "ASSOCIATOR OF ..."

I got the following code chunk which is used to get the hard disk serial number given a partition. And I need to speed it up a bit, here is the slow part of the code : //... var partition = "Disk #0, Partition #0";//previously computed, hard…
Wasabi
  • 456
  • 1
  • 4
  • 12
2
votes
0 answers

WMI Intrinsic Events consumption - how is it handled?

I have recently written a C# application for monitoring a selection of server applications that restarts them in the event of a crash. The application itself is working fine. However, I have a 'gap' in my knowledge that concerns me, and I have not…
Jonathon Ogden
  • 1,562
  • 13
  • 19
2
votes
1 answer

How to extract a particular attribute from instance of Win32_PnPEntity?

def getPnpDeviceInfo(): c = wmi.WMI() wql = "SELECT * FROM Win32_PnPEntity WHERE Manufacturer != 'Microsoft' AND NOT PNPDeviceID LIKE 'ROOT\\%'" print ("All physical PNP devices") for J in c.query(wql): print(J) This function…
2
votes
1 answer

WQL for enumerating all classes in a namespace

I am able to use the following query successfully on WMI, but I am unable to make it more granular using the __genus property. Works: select * from meta_class where __class like "%win32%" Works: select * from meta_class where __class like "%win32%"…
2
votes
2 answers

How to get a count of ManagementObjects (WMI results) without enumerating through the collection in .NET

When querying for large ammount of data through WMI (say the windows events log Win32_NTLogEvent) it is very useful to know what kind of numbers you are getting yourself into before downloading all the content. Is there a way two do this? From what…
Mark
  • 5,223
  • 11
  • 51
  • 81
2
votes
0 answers

HRESULT from WMI ExecQuery is always success despite bad query

I'm trying to use ExecQuery() from http://msdn.microsoft.com/en-us/library/aa392107%28v=vs.85%29.aspx in a program, but I'm having problems with errors. Specifically, if the WQL query is good, then everything works. The results are good, I can…
Kcaz
  • 21
  • 2
2
votes
2 answers

Querying access to a UNC path on a remote machine via WMI

I want to find out if the remote host has r/w access to a network share. To start out I wanted to see if I could query the target host's ability to query the UNC path for info, ala var query = string.Format("select * from CIM_Directory where name =…
Zoinks
  • 361
  • 1
  • 2
  • 11
2
votes
1 answer

Retrieving the type of a WMI property using WQL

I can find the classes a WMI host supports using a WQL query of SELECT * FROM meta_class This returns the classes and their methods and properties. These seem to be all strings. I'm trying to do some discovery and while having the property names is…
Paul Rubel
  • 26,632
  • 7
  • 60
  • 80
2
votes
3 answers

how to parse USB Device Instance ID (DIID)?

I want to know how "Device Instance ID" is made or how to parse it. Take the following string as an example: USB\VID_093A&PID_2700&MI_00\6&2703A67B&0&0000 As per my knowledge: USB tells that this is a USB device VID_093A indicates its vendor…
2
votes
2 answers

Can I get the ExecutablePath from a System.Management.EventArrivedEventArgs object?

I'm using a System.Management.ManagementEventWatcher to get the process ID and executable path for a started process: private void startWatcher_EventArrived(Object sender, EventArrivedEventArgs e) { String processID =…
Mike Pateras
  • 14,715
  • 30
  • 97
  • 137
2
votes
1 answer

WQL with string finding in where clause

I'm looking a way to search for USB devices where the DeviceID contains the string literal VID_217C. Is it possible? In other words, I'm looking for the following query select * from Win32_USBHub where DeviceID contains "VID_217C" to return only…
Donotalo
  • 12,748
  • 25
  • 83
  • 121
1 2
3
13 14