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
4
votes
1 answer

MSNdis_StatusMediaDisconnect and device Unique Name

I'm using ManagementEventWatcher to watch the disconnection of network cable using System.Management. ManagementEventWatcher with the WQL: SELECT * FROM MSNdis_StatusMediaDisconnect, and the following method is fired, when EventArrived: private…
user236340
4
votes
2 answers

Getting CPU ID code from C# to be in C++

I have this C# code to get Processor ID but I'm not able to pass it to C++, I tried a lot but I really can't, I just started in C++ and I would like to be able to get the CPU ID with C++ like I used to get with C# This is the code I have in…
Luiza Nunes
  • 43
  • 1
  • 1
  • 3
3
votes
2 answers

How do I count the total number of rows returned from a WQL query?

I am trying to find the total number of CPUs on a computer via get-wmiobject. The query: select * from win32_processor returns more than 1 row if there is more than 1 processor on the computer. WQL doesn't have the count keyword like in TSQL. So I…
deutschZuid
  • 1,028
  • 2
  • 15
  • 33
3
votes
1 answer

Memory leak in Microsoft's WMI library. Is there a way to mitigate it?

When we write 156KB worth of key:value pairs to the WMI using IWbemQualifierSet::Put this method creates 2GB of dangling allocations. I've never encountered a bug like this in a Microsoft library so I'm not really sure what to do about it. Is there…
Pulpo
  • 224
  • 2
  • 12
3
votes
1 answer

PowerShell output returns more fields than selected

I've been learning PowerShell over the past month and often times I've found through select statements or -properties iirc, that I get additional data that I don't ask for. Hoping someone can point out why it spits out extra…
Ayyub
  • 33
  • 3
3
votes
1 answer

How come the "SerialNumber" property of the "Win32_CDROMDrive" class returns null when asking for it separately from WMI?

When acquiring the value of the property SerialNumber from the WMI class Win32_CDROMDrive like this SELECT SerialNumber FROM Win32_CDROMDrive it throughs a NullReferenceException unless i change the query to SELECT * FROM Win32_CDROMDrive. Then loop…
Peter Tovar
  • 138
  • 5
3
votes
1 answer

Retrieve specific drive data - Get-WmiObject Win32_logicaldisk

I am attempting to retrieve the FreeSpace for a specific drive using Get-WmiObject. Using Get-WmiObject Win32_logicaldisk on my machine returns the following: PS C:\Users\Julian\Desktop\Tools\Powershell> Get-WmiObject Win32_logicaldisk |…
DanishPleb
  • 33
  • 1
  • 1
  • 5
3
votes
1 answer

Difference between ASSOCIATOR OF and ManagementObjectCollection method GetRelated

I've noticed that with WMI queries, ie WQL - SQL for WMI, that you can utilize Associators to access 2 classes in the same namespace like Msvm_VirtualSystemSettingData and Msvm_ResourceAllocationSettingData that are a part of…
cameracode
  • 97
  • 1
  • 10
3
votes
2 answers

double backslash in WMI/WQL query powershell

I am facing weird issue with my WQL query. $SCCMQuery = @' Select UAR.User, UAR.Application, UAR.CurrentState from sms_fullcollectionmembership as FCM INNER JOIN SMS_UserApplicationRequest as UAR ON UAR.User=FCM.SMSID where…
Roxx
  • 3,738
  • 20
  • 92
  • 155
3
votes
1 answer

IN operator in WQL

I need to write a WMI query where I need to check that some value is equal to one of the values in the list, but I didn't find that WQL supports IN operator like SQL. For example: SELECT * FROM Device WHERE __CLASS IN ("Device1", "Device20"). What…
user2060111
2
votes
1 answer

Why is my WQL Query not accepting my "IS NOT NULL" argument?

Pardon if this is something simple, tried google, and the search function here with some similiar questions, just no answer that worked for me in this scenario. For the sake of trying to avoid the pipeline as much as possible, I was reading into the…
Abraham Zinala
  • 4,267
  • 3
  • 9
  • 24
2
votes
1 answer

Calling WMI methods via a WQL query

I'd like to call a static method via WMI using WQL (basically the equivalent of the "Execute Method" button in wbemtest.exe), but I'm having trouble finding syntax examples. I have a custom WMI provider named "HelloWmi" with the following…
Monica Woods
  • 147
  • 1
  • 6
2
votes
1 answer

Changing WMI/WQL results output

Now this is a odd one but as I don't know WMI/WQL I hope someone can help and spot a simple mistake.. I need to find out if a system is a domain controller or not - simple with WMI select DomainRole from Win32_ComputerSystem gets the data. However…
Dreaddan
  • 687
  • 1
  • 7
  • 14
2
votes
0 answers

How to SELECT a single field from a Win32 WMI class?

Win32 Classes in Windows OS are groups of Hardware, Software or OS classes (along with others) that contains features and attributes depending on the class selected. My problem is with the Win32_CDROMDrive that has many properties of the connected…
Peter Tovar
  • 138
  • 5
2
votes
2 answers

Unable to search directory subtree with WQL query

I am attempting to find all .PST files for the logged on user. However, I seem unable to add a path to 'Drive'. I would like to search all files under C:\users\ + $env:UserName This command seems to find all PST files on C:\ $Res = Get-CimInstance…
tacosnooper
  • 73
  • 1
  • 7
1
2
3
13 14