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   : 6
Hour        : 5
Milliseconds:
Minute      : 13
Month       : 5
Quarter     : 2
Second      : 6
WeekInMonth : 4
Year        : 2022

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, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please 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).
Saturday May 28 2022 at 3:11pm
Visit MAKEMSI's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.