Questions tagged [wmi]

Windows Management Instrumentation (WMI) is an API for managing the Windows operating system on local or remote computers.

4365 questions
16
votes
8 answers

How to check the machine type? laptop or desktop?

How to check current machine type? laptop or desktop ? I got this from http://blog.csdn.net/antimatterworld/archive/2007/11/11/1878710.aspx ,it works well on my home machine(Win2003 on laptop), it returns "Portable", but failed on my work…
Cooper.Wu
  • 4,335
  • 8
  • 34
  • 42
15
votes
6 answers

How do I detect a disabled Network Interface Connection from a Windows application?

I would like to know when a interface has been disabled. If I go into the windows manager and disable one of the 2 enabled connections, GetIfTable() only returns status about 1 interface, it no longer sees the disconnected one. (Returns 1…
T.T.T.
  • 33,367
  • 47
  • 130
  • 168
15
votes
5 answers

How do I use WMI with Delphi without drastically increasing the application's file size?

I am using Delphi 2010, and when I created a console application that prints "Hello World", it takes 111 kb. If I want to query WMI with Delphi, I add WBEMScripting_TLB, ActiveX, and Variants units to my project. If I perform a simple WMI query, my…
Mick
  • 13,248
  • 9
  • 69
  • 119
15
votes
4 answers

Query WMI from Go

I would like to run WMI queries from Go. There are ways to call DLL functions from Go. My understanding is that there must be some DLL somewhere which, with the correct call, will return some data I can parse and use. I'd prefer to avoid calling…
mjibson
  • 16,852
  • 8
  • 31
  • 42
15
votes
3 answers

How to know the CPU and memory usage of a process with WMI?

I am using a wmi and python in order to track the behavior of the process running on my machine. from win32com.client import GetObject wmi = GetObject('winmgmts:') processes = wmi.InstancesOf('Win32_Process') for process in processes: print…
luc
  • 41,928
  • 25
  • 127
  • 172
15
votes
1 answer

Cannot read BCDStore info on Windows 2012 Server using WMI

We are using the following function to get the number of processors specified by the current boot configuration. This number is used purely for logging. The function below works fine on XP, Vista, 7, 2003 and 2008. It, however, fails on the Windows…
gabr
  • 26,580
  • 9
  • 75
  • 141
14
votes
3 answers

Returning CPU usage in WMI using C#

To return the CPU usage by using WMI, do I return the PercentProcessorTime from Win32_PerfFormattedData_PerfOS_Processor? If not, which class should I look towards? Thanks.
jpavlov
  • 2,215
  • 9
  • 43
  • 58
14
votes
3 answers

Delphi - finding the process that is accessing a file from my program

I have a Delphi app that regularly writes to a local disk file. Occasionally it is unable to access the file - a sharing violation results when it tries to open it. A retry after a short delay is all that is needed, but when it occurs, I would…
rossmcm
  • 5,493
  • 10
  • 55
  • 118
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
14
votes
3 answers

WMI: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA) throws when try to connect to remote machine

I'm using the following code to connect to remote machine using WMI: ConnectionOptions connOptions = new ConnectionOptions(); connOptions.Impersonation = ImpersonationLevel.Impersonate; connOptions.EnablePrivileges =…
vasyl
  • 235
  • 3
  • 4
  • 13
14
votes
4 answers

WMI to reboot remote machine

I found this code on an old thread to shutdown the local machine: using System.Management; void Shutdown() { ManagementBaseObject mboShutdown = null; ManagementClass mcWin32 = new ManagementClass("Win32_OperatingSystem"); …
Stephen Murby
  • 1,407
  • 3
  • 17
  • 37
14
votes
1 answer

How to determine Windows.Diagnostics.Process from ServiceController

This is my first post, so let me start by saying HELLO! I am writing a windows service to monitor the running state of a number of other windows services on the same server. I'd like to extend the application to also print some of the memory…
Alex
  • 995
  • 9
  • 11
14
votes
2 answers

How can I improve the WMI performance using delphi?

I wrote a simple function to retrieve system information using the WMI, passing as parameter the class and the property name. when I execute the function like this Writeln('Procesor Id '+GetWMIInfo('Win32_Processor','Name')); Writeln('Mother…
Salvador
  • 16,132
  • 33
  • 143
  • 245
13
votes
2 answers

Time left until Windows suspend

Is there a way to query windows how much time is left until it goes to suspend/sleep mode? I am using vbscript and suspect there might be a WMI answer, but any language like c/c++, *.NET, or even java, if possible, may fit my needs. EDIT I want to…
Eduardo Poço
  • 2,819
  • 1
  • 19
  • 27
13
votes
1 answer

How to calculate memory usage as Task Manager does?

Ok so I am using WMI (.net/C#) to constantly collect data about a specific process that is running on the machine. I get the data through Win32_PerfFormattedData_PerfProc_Process class. That class has a lot of properties but those that we are…
Mihail Shishkov
  • 14,129
  • 7
  • 48
  • 59