Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WMI Data Retrieval FAQ posted 2

Status
Not open for further replies.

Glenn9999

Programmer
Jun 19, 2004
2,312
US
I posted a FAQ on how to get data (hardware info, threads, processes, and so forth) from WMI for a computer. The specific example is how to get a list of command-lines for running processes.

faq102-7315

I'm waiting for the white paper entitled "Finding Employment in the Era of Occupational Irrelevancy
 
To show the power of what WMI can do, here's all the tasks (minus the temporary directory) listed in the FAQ section, which should represent a good cross-sample of call examples.

Get total physical memory in machine:
SELECT TotalPhysicalMemory FROM Win32_ComputerSystem

Get Free space and disk size for logical drive letter:
SELECT DeviceID, FreeSpace, Size FROM Win32_LogicalDisk

Get Computer Name:
SELECT Name FROM Win32_ComputerSystem

Get processor clock speed:
SELECT CurrentClockSpeed FROM Win32_Processor

Get Windows System Directory:
SELECT SystemDirectory FROM Win32_OperatingSystem

Get Windows Version (e.g. 5.1.2600 for Windows XP):
SELECT Version FROM Win32_OperatingSystem

Get current logged on user:
SELECT UserName FROM Win32_ComputerSystem

The temporary directory function can be done in WMI but involves a method call, and I run into the same issue as the thread I posted on it.

I'm waiting for the white paper entitled "Finding Employment in the Era of Occupational Irrelevancy
 
I posted a FAQ on calling the WMI methods and getting registry values.

faq102-7316

I'm waiting for the white paper entitled "Finding Employment in the Era of Occupational Irrelevancy
 
I was working with some more WMI code and I had the thought of possibly turning this into a component if I can make things easier in the long run with it (and I don't know the answer to that). Is there any interest in this if I were to share it?

Anyway the main question I had regarding this is as follows: What would one look like? Would it be worth trying to tie it into the data-aware controls, or would it be too off-spec for what WMI code would be used for?

Maybe I'm getting at this: How do you know when a component would be handy as opposed to code like was posted in the FAQ?

I'm waiting for the white paper entitled "Finding Employment in the Era of Occupational Irrelevancy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top