MAKEMSI quickly and reliably creates MSI files in a non-programmatic way
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
[Bottom][Contents][Prev]: WMI (Windows Management Instrumentation)[Next]: DELL's OMCI WMI Provider
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Tips and Tricks->Tools->WMI (Windows Management Instrumentation)->WMI Sample Query

WMI Sample Query

The following output (WIN32_UTCTime) was generated by the script below:

Day         : 28
DayOfWeek   : 4
Hour        : 1
Milliseconds:
Minute      : 31
Month       : 8
Quarter     : 3
Second      : 4
WeekInMonth : 5
Year        : 2008

The following code produced the above output:

On Error Resume Next
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly       = &h20
const ThisComputer              = "."

Set objWMIService = GetObject("winmgmts:\\" & ThisComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_UTCTime", "WQL", _
                                      wbemFlagReturnImmediately + wbemFlagForwardOnly)

For Each objItem In colItems
  WScript.Echo "Day         : " & objItem.Day
  WScript.Echo "DayOfWeek   : " & objItem.DayOfWeek
  WScript.Echo "Hour        : " & objItem.Hour
  WScript.Echo "Milliseconds: " & objItem.Milliseconds
  WScript.Echo "Minute      : " & objItem.Minute
  WScript.Echo "Month       : " & objItem.Month
  WScript.Echo "Quarter     : " & objItem.Quarter
  WScript.Echo "Second      : " & objItem.Second
  WScript.Echo "WeekInMonth : " & objItem.WeekInMonth
  WScript.Echo "Year        : " & objItem.Year
  WScript.Echo
Next


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006 & 2007 for the Windows SDK (Windows Installer) area.This external link was OK when tested at 23 Aug 2008Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: WMI (Windows Management Instrumentation)[Next]: DELL's OMCI WMI Provider


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Thursday August 28 2008 at 11:28am
Visit MAKEMSI's Home PageThis external link was OK when tested at 13 Aug 2008

HTML page dated Mon, 29 Jan 2007 00:11:11 GMT
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006 & 2007 for the Windows SDK (Windows Installer) area.This external link was OK when tested at 23 Aug 2008