views:

51

answers:

1

All,

Please forgive my ignorance of C#/.NET, I am absolutely new to both (mostly Java, C/C++) and find myself tasked with creating some code that performs the same thing as the "wmic qfe" and "wmic os" commands available at the DOS prompt.

Can this be done? If so, any help is appreciated. I am trying to working my way through the System.Management.Instrumentation namespace since wmic is an acronym for Windows Management Instrumentation Command (according to Google), but have as yet to discover anything useful.

Thanks in advance, Toddw

+2  A: 

You will indeed need to use the System.Management namespace to perform WMI queries. There is lots info on using WMI from C#, Microsoft's is at at http://msdn.microsoft.com/en-us/library/ms186146%28v=VS.80%29.aspx

For your specific cases:

qfe - query the Win32_QuickFixEngineering class

os - query the Win32_OperatingSystem class

Stuart Dunkeld
+1, but drop Instrumentation from the namespace name.
Hans Passant
@Hans - thanks.
Stuart Dunkeld
@Stuart, @Hans, thanks this is just what I needed to get started
Todd