Jump to content


  • 0
anyweb

pulling values from WMI class.

Question

let's say you need to pull values from the operating system WMI class, in XP you can do as follows:-

 

open a command prompt and try this

 

wmic.exe path win32_BaseBoard get /format:htable > win32_BaseBoard_test.html

 

the above will pull all values for win32_BaseBoard and place the output in a html formatted table which you can view in Internet Explorer (will not display correctly in Firefox).

 

attached is an example output of the above code.

 

cheers

anyweb

win32_BaseBoard_test.html

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

A tool that has been indispensible for me is WMICodeCreator ( http://www.microsoft...&displaylang=en ). It is a Microsoft freebie, and is basically a GUI WMI browser. To top it all off, it will generate code in VBScript, VB, or C# that performs the query you selected in the GUI. It is pretty handy.

 

Another tool that I have started liking alot lately is PowerShell. It has a cool Get-Member cmdlet that shows you all of the properties and methods of an object. You can see all of your options, and then query the object for one of its values, or perform one of the objects methods.

 

The following example gets the Win32_BIOS object, enumerates the object's properties and methods, and then queries the object for its BIOS version and Manufacturer

 

PS C:\Documents and Settings\mcarter> $oBIOS = Get-WmiObject Win32_BIOS
PS C:\Documents and Settings\mcarter> $oBIOS | Get-Member


  TypeName: System.Management.ManagementObject#root\cimv2\Win32_BIOS

Name              	MemberType   Definition
----              	----------   ----------
BiosCharacteristics   Property 	System.UInt16[] BiosCharacteristics {get;set;}
BIOSVersion   		Property 	System.String[] BIOSVersion {get;set;}
BuildNumber   		Property 	System.String BuildNumber {get;set;}
Caption       		Property 	System.String Caption {get;set;}
CodeSet       		Property 	System.String CodeSet {get;set;}
CurrentLanguage   	Property 	System.String CurrentLanguage {get;set;}
Description   		Property 	System.String Description {get;set;}
IdentificationCode	Property 	System.String IdentificationCode {get;set;}
InstallableLanguages  Property 	System.UInt16 InstallableLanguages {get;set;}
InstallDate   		Property 	System.String InstallDate {get;set;}
LanguageEdition   	Property 	System.String LanguageEdition {get;set;}
ListOfLanguages   	Property 	System.String[] ListOfLanguages {get;set;}
Manufacturer      	Property 	System.String Manufacturer {get;set;}
Name              	Property 	System.String Name {get;set;}
OtherTargetOS 		Property 	System.String OtherTargetOS {get;set;}
PrimaryBIOS   		Property 	System.Boolean PrimaryBIOS {get;set;}
ReleaseDate   		Property 	System.String ReleaseDate {get;set;}
SerialNumber      	Property 	System.String SerialNumber {get;set;}
SMBIOSBIOSVersion 	Property 	System.String SMBIOSBIOSVersion {get;set;}
SMBIOSMajorVersion	Property 	System.UInt16 SMBIOSMajorVersion {get;set;}
SMBIOSMinorVersion	Property 	System.UInt16 SMBIOSMinorVersion {get;set;}
SMBIOSPresent 		Property 	System.Boolean SMBIOSPresent {get;set;}
SoftwareElementID 	Property 	System.String SoftwareElementID {get;set;}
SoftwareElementState  Property 	System.UInt16 SoftwareElementState {get;set;}
Status            	Property 	System.String Status {get;set;}
TargetOperatingSystem Property 	System.UInt16 TargetOperatingSystem {get;set;}
Version       		Property 	System.String Version {get;set;}
__CLASS       		Property 	System.String __CLASS {get;set;}
__DERIVATION      	Property 	System.String[] __DERIVATION {get;set;}
__DYNASTY     		Property 	System.String __DYNASTY {get;set;}
__GENUS       		Property 	System.Int32 __GENUS {get;set;}
__NAMESPACE   		Property 	System.String __NAMESPACE {get;set;}
__PATH            	Property 	System.String __PATH {get;set;}
__PROPERTY_COUNT  	Property 	System.Int32 __PROPERTY_COUNT {get;set;}
__RELPATH     		Property 	System.String __RELPATH {get;set;}
__SERVER          	Property 	System.String __SERVER {get;set;}
__SUPERCLASS      	Property 	System.String __SUPERCLASS {get;set;}
PSStatus          	PropertySet  PSStatus {Status, Name, Caption, SMBIOSPresent}
ConvertFromDateTime   ScriptMethod System.Object ConvertFromDateTime();
ConvertToDateTime 	ScriptMethod System.Object ConvertToDateTime();
Delete            	ScriptMethod System.Object Delete();
GetType       		ScriptMethod System.Object GetType();
Put           		ScriptMethod System.Object Put();


PS C:\Documents and Settings\mcarter> $oBIOS.BIOSVersion
DELL   - 27d7060d
Phoenix ROM BIOS PLUS Version 1.10 A17
PS C:\Documents and Settings\mcarter> $oBIOS.Manufacturer
Dell Inc.
PS C:\Documents and Settings\mcarter>

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.