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]: ListProperties.vbs[Next]: 7Zip.EXE
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)->Microsoft WMI Object Queries->DumpWmiObjectInfo.vbs

DumpWmiObjectInfo.vbs

This dumps quite a range of information for a particular class (in this example "Win32_Service") and combines some of the information seen in other example code:

'========================================================================
'=== Modified Listing C in Microsoft's "WMI Scripting Primer: Part 2" ===
'========================================================================

'--- Dump what object? ------------------------------------------------------
strComputer   = "."
strNameSpace  = "root\cimv2"
strClass      = "Win32_Service"

'--- Don't allow use via WSCRIPT! -------------------------------------------
if ucase(mid(wscript.FullName, len(wscript.Path) + 2, 1)) = "W" Then
   wscript.echo "You can't use WSCRIPT on this VB script, use CSCRIPT instead!"
   ExitRc 999
end if



Set objClass = GetObject("winmgmts:\\" & strComputer & _
                         "\" & strNameSpace & ":" & strClass)

WScript.Echo strClass & " Class Qualifiers"
WScript.Echo "------------------------------"
i = 1
For Each objClassQualifier In objClass.Qualifiers_
    If VarType(objClassQualifier.Value) = (vbVariant + vbArray) Then
        strQualifier = i & ". " & objClassQualifier.Name & " = " & _
                                  Join(objClassQualifier.Value, ",")
    Else
        strQualifier = i & ". " & objClassQualifier.Name & " = " & _
                                  objClassQualifier.Value
    End If
    WScript.Echo strQualifier
    strQualifier = ""
    i = i + 1
Next

WScript.Echo
WScript.Echo strClass & " Class Properties and Property Qualifiers"
WScript.Echo "------------------------------------------------------"
i = 1 : j = 1
For Each objClassProperty In objClass.Properties_
    WScript.Echo i & ". " & objClassProperty.Name
    For Each objPropertyQualifier In objClassProperty.Qualifiers_
        If VarType(objPropertyQualifier.Value) = (vbVariant + vbArray) Then
            strQualifier = i & "." & j & ". " & _
                           objPropertyQualifier.Name & " = " & _
                           Join(objPropertyQualifier.Value, ",")
        Else
            strQualifier = i & "." & j & ". " & _
                           objPropertyQualifier.Name & " = " & _
                           objPropertyQualifier.Value
        End If
        WScript.Echo strQualifier
        strQualifier = ""
        j = j + 1
    Next
    WScript.Echo
    i = i + 1 : j = 1
Next

WScript.Echo
WScript.Echo strClass & " Class Methods and Method Qualifiers"
WScript.Echo "-------------------------------------------------"
i = 1 : j = 1
For Each objClassMethod In objClass.Methods_
    WScript.Echo i & ". " & objClassMethod.Name
    For Each objMethodQualifier In objClassMethod.Qualifiers_
        If VarType(objMethodQualifier.Value) = (vbVariant + vbArray) Then
            strQualifier = i & "." & j & ". " & _
                           objMethodQualifier.Name & " = " & _
                           Join(objMethodQualifier.Value, ",")
        Else
            strQualifier = i & "." & j & ". " & _
                           objMethodQualifier.Name & " = " & _
                           objMethodQualifier.Value
        End If
        WScript.Echo strQualifier
        strQualifier = ""
        j = j + 1
    Next
    WScript.Echo
    i = i + 1 : j = 1
Next

Sample Output

Win32_Service Class Qualifiers
------------------------------
1. dynamic = True
2. Locale = 1033
3. provider = CIMWin32
4. SupportsUpdate = True
5. UUID = {8502C4D9-5FBB-11D2-AAC1-006008C78BC7}

Win32_Service Class Properties and Property Qualifiers
------------------------------------------------------
1. AcceptPause
1.1. CIMTYPE = boolean
1.2. MappingStrings = Win32API|Service Structures|SERVICE_STATUS|dwControlsAccepted|SERVICE_ACCEPT_PAUSE_CONTINUE
1.3. read = True

2. AcceptStop
2.1. CIMTYPE = boolean
2.2. MappingStrings = Win32API|Service Structures|SERVICE_STATUS|dwControlsAccepted|SERVICE_ACCEPT_STOP
2.3. read = True

3. Caption
3.1. CIMTYPE = string
3.2. MaxLen = 64
3.3. read = True

4. CheckPoint
4.1. CIMTYPE = uint32
4.2. MappingStrings = Win32API|Service Structures|SERVICE_STATUS|dwCheckPoint
4.3. read = True

5. CreationClassName
5.1. CIM_Key = True
5.2. CIMTYPE = string
5.3. read = True

6. DelayedAutoStart
6.1. CIMTYPE = boolean
6.2. MappingStrings = Win32API|Service Structures|SERVICE_DELAYED_AUTO_START_INFO|fDelayedAutostart
6.3. read = True

7. Description
7.1. CIMTYPE = string
7.2. read = True

8. DesktopInteract
8.1. CIMTYPE = boolean
8.2. MappingStrings = Win32API|Service Structures|QUERY_SERVICE_CONFIG|dwServiceType|SERVICE_INTERACTIVE_PROCESS
8.3. read = True

9. DisplayName
9.1. CIMTYPE = string
9.2. MappingStrings = Win32API|Service Structures|QUERY_SERVICE_CONFIG|lpDisplayName
9.3. read = True

10. ErrorControl
10.1. CIMTYPE = string
10.2. MappingStrings = Win32API|Service Structures|QUERY_SERVICE_CONFIG|dwErrorControl
10.3. read = True
10.4. ValueMap = Ignore,Normal,Severe,Critical,Unknown

11. ExitCode
11.1. CIMTYPE = uint32
11.2. MappingStrings = Win32API|Service Structures|SERVICE_STATUS|dwWin32ExitCode
11.3. read = True

12. InstallDate
12.1. CIMTYPE = datetime
12.2. MappingStrings = MIF.DMTF|ComponentID|001.5
12.3. read = True

13. Name
13.1. CIMTYPE = string
13.2. key = True
13.3. read = True

14. PathName
14.1. CIMTYPE = string
14.2. MappingStrings = Win32API|Service Structures|QUERY_SERVICE_CONFIG|lpBinaryPathName
14.3. read = True

15. ProcessId
15.1. CIMTYPE = uint32
15.2. MappingStrings = Win32API|Service Structures|SERVICE_STATUS_PROCESS|dwProcessId
15.3. read = True

16. ServiceSpecificExitCode
16.1. CIMTYPE = uint32
16.2. MappingStrings = Win32API|Service Structures|SERVICE_STATUS|dwServiceSpecificExitCode
16.3. read = True

17. ServiceType
17.1. CIMTYPE = string
17.2. MappingStrings = Win32API|Service Structures|QUERY_SERVICE_CONFIG|dwServiceType
17.3. read = True
17.4. ValueMap = Kernel Driver,File System Driver,Adapter,Recognizer Driver,Own Process,Share Process,Interactive Process

18. Started
18.1. CIMTYPE = boolean
18.2. read = True

19. StartMode
19.1. CIMTYPE = string
19.2. Override = StartMode
19.3. read = True
19.4. ValueMap = Boot,System,Auto,Manual,Disabled

20. StartName
20.1. CIMTYPE = string
20.2. MappingStrings = Win32API|Service Structures|QUERY_SERVICE_CONFIG|lpServiceStartName
20.3. read = True

21. State
21.1. CIMTYPE = string
21.2. MappingStrings = Win32API|Service Structures|SERVICE_STATUS|dwCurrentState
21.3. read = True
21.4. ValueMap = Stopped,Start Pending,Stop Pending,Running,Continue Pending,Pause Pending,Paused,Unknown
21.5. write = True

22. Status
22.1. CIMTYPE = string
22.2. MaxLen = 10
22.3. read = True
22.4. ValueMap = OK,Error,Degraded,Unknown,Pred Fail,Starting,Stopping,Service,Stressed,NonRecover,No Contact,Lost Comm

23. SystemCreationClassName
23.1. CIM_Key = True
23.2. CIMTYPE = string
23.3. Propagated = CIM_System.CreationClassName
23.4. read = True

24. SystemName
24.1. CIM_Key = True
24.2. CIMTYPE = string
24.3. Propagated = CIM_System.Name
24.4. read = True

25. TagId
25.1. CIMTYPE = uint32
25.2. MappingStrings = Win32API|Service Structures|QUERY_SERVICE_CONFIG|dwTagId
25.3. read = True

26. WaitHint
26.1. CIMTYPE = uint32
26.2. MappingStrings = Win32API|Service Structures|SERVICE_STATUS|dwWaitHint
26.3. read = True


Win32_Service Class Methods and Method Qualifiers
-------------------------------------------------
1. StartService
1.1. MappingStrings = Win32API|Service Functions|StartService
1.2. Override = StartService
1.3. ValueMap = 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,..

2. StopService
2.1. MappingStrings = Win32API|Service Functions|ControlService|dwControl|SERVICE_CONTROL_STOP
2.2. Override = StopService
2.3. ValueMap = 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,..

3. PauseService
3.1. MappingStrings = Win32API|Service Functions|ControlService|dwControl|SERVICE_CONTROL_PAUSE
3.2. ValueMap = 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,..

4. ResumeService
4.1. MappingStrings = Win32API|Service Functions|ControlService|dwControl|SERVICE_CONTROL_CONTINUE
4.2. ValueMap = 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,..

5. InterrogateService
5.1. MappingStrings = Win32API|Service Functions|ControlService|dwControl|SERVICE_CONTROL_INTERROGATE
5.2. ValueMap = 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,..

6. UserControlService
6.1. MappingStrings = Win32API|Service Functions|CreateService|dwDesiredAccess|SERVICE_USER_DEFINED_CONTROL
6.2. ValueMap = 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,..

7. Create
7.1. MappingStrings = Win32API|Service Functions|CreateService
7.2. Static = True
7.3. ValueMap = 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,..

8. Change
8.1. MappingStrings = Win32API|Service Functions|ChangeServiceConfig
8.2. ValueMap = 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,..

9. ChangeStartMode
9.1. MappingStrings = Service Functions|ChangeServiceConfig|dwStartType
9.2. ValueMap = 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,..

10. Delete
10.1. MappingStrings = Win32API|Service Functions|ChangeServiceConfig|DeleteService
10.2. ValueMap = 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,..

11. GetSecurityDescriptor
11.1. implemented = True
11.2. Privileges = SeSecurityPrivilege
11.3. ValueMap = 0,2,8,9,21,..

12. SetSecurityDescriptor
12.1. implemented = True
12.2. Privileges = SeSecurityPrivilege
12.3. ValueMap = 0,2,8,9,21,..


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]: ListProperties.vbs[Next]: 7Zip.EXE


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Sunday February 28 2016 at 3:45pm
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.