Query over the content of CIM repository on Windows Machines that uses WQL (Windows Management Instrumentation Query Language ).
Questions tagged [wmi-query]
545 questions
29
votes
3 answers
How can I retrieve a Windows Computer's SID using WMI?
I'm not looking for User SIDs. I'm looking for the computer SID, which active directory would use to uniquely identify the computer. I also don't want to query the active directory server, i want to query the computer itself.

Mark
- 5,223
- 11
- 51
- 81
14
votes
4 answers
c# 'Invalid class' in a simple WMI query
I will like to find some result after this query, but in the beginning of the foreach loop, the error "invalid class" occur.
string wmiQuery = string.Format("SELECT * FROM Win32_Process");
var searcher = new ManagementObjectSearcher(wmiQuery);
var…

Guillaume V
- 931
- 2
- 10
- 27
13
votes
3 answers
Determine Network Adapter Type via WMI
I'm using WMI (Win32_NetworkAdapter) and trying to get the details of attached physical network adapters either wired or wireless and avoid virtual adapters, etc.
Reading this article it explains that you have to do some clever querying on WMI to…

ScottN
- 1,490
- 2
- 20
- 34
12
votes
2 answers
How to construct WMI query
I'd like to find results that Name starts with param1, and ends with param2 but my code doesn't work
string wmiQuery = string.Format("SELECT CommandLine FROM Win32_Process WHERE Name LIKE '{0}%' AND Name LIKE '%{1}'", param1,…

Saint
- 5,397
- 22
- 63
- 107
12
votes
5 answers
"The RPC server is unavailable" using WMI query
I have a workgroup of web servers running Server 2008 R2 in which I'm trying to manage a script that checks the disk space of all of them. I had set this up a few months ago when the servers were being set up and I believe it was working fine. Now I…

jwynveen
- 1,261
- 3
- 15
- 34
11
votes
5 answers
Can the physical USB port be identified programmatically for a device in Windows?
I have a USB device that enumerates with a different interface, VID, PID and serial number when commanded to do so, and I'd like to keep track of the physical device after this change occurs. My thought was to track it by its hub and port…

Judge Maygarden
- 26,961
- 9
- 82
- 99
10
votes
5 answers
Get Service Account Details of the SQL Agent Service
How can I get the Service Account name for the SQL Agent service for a particular SQL Server (SQL 2005).
Is it possible to get using SQL statements or WMI ?

John
- 703
- 7
- 18
- 37
9
votes
6 answers
How do you query for WMI namespaces?
How do you query for WMI namespaces?
So I know about WMI namespaces because I read that they exits and I know I can connect to say:
root\cimv2
My question is what if I didn't know what namespaces were there, how would I go about querying for the…

Matt
- 25,943
- 66
- 198
- 303
9
votes
1 answer
How to get notifications for File Changes on CD / DVD drive?
I am new to C# and have to develop a Windows Form application in C#. This application should track the following things.
Monitor the CD / DVD drives both external and internal.
Monitor the files which are created, modified and deleted on the CD/DVD…

Kunal Jha
- 2,102
- 4
- 24
- 34
8
votes
2 answers
How can I determine the version of a device driver when the device is not plugged in?
Thanks to some other helpful StackOverflow questions, I've found a way to query WMI for device drivers. However, it seems to me that the data is being stored in disparate places that don't join together well.
I have a USB-to-serial port cable using…

soapergem
- 9,263
- 18
- 96
- 152
8
votes
3 answers
Is there a way to query WMI without using PowerShell or CIM Studio?
I'd like to query WMI for WCF service information, but I'd rather not use PowerShell or the CIM Studio. Any other tools for doing this (command-line is cool too)?

Jordan Parmer
- 36,042
- 30
- 97
- 119
7
votes
1 answer
WMI query - CPU LoadPercentage
I´m searching for a better way to get the CPU load in percent with WMI from multiple systems(means different CPUs etc.).
My code is working, but I think there is a better way to get over all CPU usage in percent.
Any ideas?
Thank you in…

LaPhi
- 5,675
- 21
- 56
- 78
7
votes
1 answer
GET USB unique ID on putting or removing the key
I need to get the unique USB ID (not a Volume serial number ) on putting/removing the USB. But in all case "PNPDeviceID" is always empty.
The code which I used is:
static void Main(string[] args)
{
const string QUERY = @"select * from…

Tiho
- 123
- 2
- 8
7
votes
0 answers
How to get a number of rras sstp ports with WMI query?
With PowerShell I can use cmdlet (Get-VpnServerIPsecConfiguration).SstpPorts
But we have strict security policies, so I have to get only WMI counters with Get-WmiObject -Query.
I tried to google, but couldn't find a certain class for this…

rGA145
- 155
- 2
- 11
7
votes
1 answer
Explain VBScript WMI query / impersonationLevel, etc
Dim strComputer, objReg, ScriptName, strKeyPath, strValueName, strValue
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer &…

user3515319
- 75
- 1
- 1
- 4